Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59373

JenkinsRule not working with Gradle JPI Plugin

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • gradle-jpi-plugin
    • None

      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?

            lazlodeveloper Laszlo Dian
            andrewsumner Andrew Sumner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: