[JIRA] (JENKINS-59373) JenkinsRule not working with Gradle JPI Plugin

16 views
Skip to first unread message

andrew.sumner@xtra.co.nz (JIRA)

unread,
Sep 14, 2019, 12:12:03 AM9/14/19
to jenkinsc...@googlegroups.com
Andrew Sumner created an issue
 
Jenkins / Bug JENKINS-59373
JenkinsRule not working with Gradle JPI Plugin
Issue Type: Bug Bug
Assignee: Steve Hill
Components: gradle-jpi-plugin
Created: 2019-09-14 04:11
Priority: Major Major
Reporter: Andrew Sumner

I'm updating the jenkinsVersion I rely on in my project https://github.com/jenkinsci/inedo-proget-plugin/tree/SecretManagement but are having problems with tests that use JenkinsRule.
 
Up to jenkins version 2.63 it works fine, from 2.64 onwards I get:

java.lang.AssertionError: D:\Work\gradle_user_home\caches\modules-2\files-2.1\org.jenkins-ci.main\jenkins-core\2.64\6766ac4d8dd4a6ca1920f5156bb10be656d4ded3\jenkins-core-2.64.jar is not in the expected location, and jenkins-war-*.war was not in D:\Work\Eclipse\workspace\inedo-proget-plugin\bin\main;
D:\Work\Eclipse\workspace\inedo-proget-plugin\bin\test;
D:\Work\gradle_user_home\caches\modules-2\files-2.1\org.concordion\cubano-httpeasy\0.3.5\f25d55eb0bc86ff10524bf91fa209be0e305ffb4\cubano-httpeasy-0.3.5.jar;
... 
long list of jar files
...
D:\Work\Eclipse\eclipse-oxygen\eclipse\configuration\org.eclipse.osgi\413\0\.cp;
D:\Work\Eclipse\eclipse-oxygen\eclipse\configuration\org.eclipse.osgi\1168\0\.cp
 at org.jvnet.hudson.test.WarExploder.explode(WarExploder.java:119)
 at org.jvnet.hudson.test.WarExploder.<clinit>(WarExploder.java:68)
 at org.jvnet.hudson.test.JenkinsRule._createWebServer(JenkinsRule.java:748)
 at org.jvnet.hudson.test.JenkinsRule.createWebServer(JenkinsRule.java:718)
 at org.jvnet.hudson.test.JenkinsRule.newHudson(JenkinsRule.java:670)
 at org.jvnet.hudson.test.JenkinsRule.before(JenkinsRule.java:402)
 at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:595)
 at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
 at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.lang.Thread.run(Thread.java:745)

 
My build.gradle file is
 

plugins {
  id 'org.jenkins-ci.jpi' version '0.28.1'
}

apply plugin: 'java'

sourceCompatibility = 1.8
targetCompatibility = 1.8

group = 'com.inedo.proget'
version = '1.2'
description = 'Inedo ProGet Plugin'

ext {
 jenkinsVersion='2.64'
}

jenkinsPlugin {
    coreVersion = "$jenkinsVersion"
    displayName = 'Inedo ProGet Plugin.'
    shortName = 'inedo-proget'
    url = 'http://wiki.jenkins-ci.org/display/JENKINS/Inedo+ProGet+Plugin'
    gitHubUrl = 'https://github.com/jenkinsci/inedo-proget-plugin'
    developers {
        developer {
            id 'andrew-sumner'
            name 'Andrew Sumner'
            email 'andrew.sumner@***.***'
        }
    }
}

repositories {
  maven { 
    url 'http://repo.jenkins-ci.org/public' } // prevent java.lang.NoClassDefFoundError: org/junit/runner/manipulation/Filter
 
    jcenter()
}

dependencies {
 compile 'org.concordion:cubano-httpeasy:0.3.5';
 
 testCompile 'com.jayway.jsonpath:json-path:2.4.0'
 testCompile 'junit:junit:4.12'
 testCompile 'org.mockito:mockito-core:2.28.2'
 testCompile 'org.jenkins-ci.main:jenkins-test-harness:2.55'
}

task wrapper(type: Wrapper) {
    gradleVersion = '4.7'
}

 

As an aside, do you know why I have to explicity add repo 'http://repo.jenkins-ci.org/public' rather than just use jcenter?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

dbeck@cloudbees.com (JIRA)

unread,
Sep 14, 2019, 5:01:02 AM9/14/19
to jenkinsc...@googlegroups.com
Daniel Beck commented on Bug JENKINS-59373
 
Re: JenkinsRule not working with Gradle JPI Plugin

https://jenkins.io/changelog/#v2.64 (last entry) explains it – there's no longer a war-for-test.

andrew.sumner@xtra.co.nz (JIRA)

unread,
Sep 16, 2019, 3:42:03 AM9/16/19
to jenkinsc...@googlegroups.com

sghill.dev@gmail.com (JIRA)

unread,
Sep 16, 2019, 1:02:02 PM9/16/19
to jenkinsc...@googlegroups.com

Hi Andrew Sumner, thanks for the report!
 
Is there a set of commands I can run to reproduce the error you're getting? After cloning your repo's master branch (commit 7988b3a76b8f1203f13d83e58e6edaec28902108), I'm able to run both ./gradlew check on the command line and com.inedo.proget.jenkins.PluginTests from IntelliJ. From the logs, it does appear to be starting and stopping the server as expected.

Thanks Daniel Beck for the link to the changelog! We could potentially make this transition a little easier in the plugin, but this is the first time it's come up as an issue. The changelog is from 2017, so this change has been out for quite a while.

As an aside, do you know why I have to explicity add repo 'http://repo.jenkins-ci.org/public' rather than just use jcenter?

Yes, it's because most jenkins-specific dependencies and plugins are not published to jcenter. They're published to the maven repository at repo.jenkins-ci.org.

Gradle Version

I see you're running Gradle 4.7. Have you considered upgrading? This version is quite old (released 2018-04-18) and the next release due out is Gradle 6.0. There are many nice features introduced in Gradle 5.x and coming in 6.x. Ideally a future release of gradle-jpi-plugin will stop supporting the Gradle 4.x series.

andrew.sumner@xtra.co.nz (JIRA)

unread,
Sep 18, 2019, 6:42:01 AM9/18/19
to jenkinsc...@googlegroups.com
Andrew Sumner closed an issue as Fixed
 

I tried again after rebooting PC and running via gradle and then eclipse, it worked fine.  Thanks and sorry for wasting your time.

Change By: Andrew Sumner
Status: Open Closed
Resolution: Fixed

laszlo.dian@outlook.hu (JIRA)

unread,
Nov 5, 2019, 10:02:03 AM11/5/19
to jenkinsc...@googlegroups.com
Laszlo Dian assigned an issue to Laszlo Dian
Change By: Laszlo Dian
Assignee: Steve Hill Laszlo Dian
Reply all
Reply to author
Forward
0 new messages