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

Dependency list not the same for pom.xml and build.gradle using gradle-jpi-plugin

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

      I have worked on creating a build.gradle file for build-flow-plugin.
      You can see my efforts by doing:

      git clone https://github.com/jenkinsci/build-flow-plugin

      While trying to create the build.gradle file, I found that I needed to explicitly add more dependencies than are listed in the pom.xml file.

      This is the dependency list for pom.xml:

      pom.xml
          <dependencies>
              <dependency>
                  <groupId>org.codehaus.groovy</groupId>
                  <artifactId>groovy-all</artifactId>
                  <version>1.8.5</version>
                  <scope>provided</scope> <!-- from jenkins-core -->
              </dependency>
              <dependency>
                  <groupId>org.jgrapht</groupId>
                  <artifactId>jgrapht-jdk1.5</artifactId>
                  <version>0.7.3</version>
              </dependency>
      
              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>${junit.version}</version>
                  <scope>test</scope>
              </dependency>
              
              <dependency>
                  <groupId>org.mockito</groupId>
                  <artifactId>mockito-all</artifactId>
                  <version>1.8.5</version>
                  <scope>test</scope>
              </dependency>
      
              <!-- Add test dependencies for pipeline plugin -->
              <dependency>
                  <groupId>org.jenkins-ci.plugins.workflow</groupId>
                  <artifactId>workflow-job</artifactId>
                  <version>${pipeline.version}</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jenkins-ci.plugins.workflow</groupId>
                  <artifactId>workflow-basic-steps</artifactId>
                  <version>${pipeline.version}</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jenkins-ci.plugins.workflow</groupId>
                  <artifactId>workflow-cps</artifactId>
                  <version>${pipeline.version}</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jenkins-ci.plugins.workflow</groupId>
                  <artifactId>workflow-durable-task-step</artifactId>
                  <version>${pipeline.version}</version>
                  <scope>test</scope>
              </dependency>
          </dependencies>
      

      This is the dependency list for build.gradle:

      build.gradle
      dependencies {
          compile "org.jgrapht:jgrapht-jdk1.5:0.7.3"
          compile 'com.cloudbees:groovy-cps:1.7@jar'
          jenkinsPlugins 'org.jenkins-ci.plugins:matrix-project:1.7@jar'
          jenkinsPlugins 'org.jenkins-ci.plugins:junit:1.13@jar'
      
          // Test dependencies
          jenkinsTest "org.jenkins-ci.plugins:ant:1.3@jar"
          jenkinsTest "org.mockito:mockito-all:1.8.5@jar"
          jenkinsTest 'org.jenkins-ci.plugins:script-security:1.19@jar'
          jenkinsTest 'org.jenkins-ci.main:maven-plugin:2.12.1@jar'
          jenkinsTest 'org.jenkins-ci.plugins:javadoc:1.3@jar'
          jenkinsTest 'org.jenkins-ci.plugins:mailer:1.17@jar'
      
          // Test dependencies for pipeline plugin
          jenkinsTest "org.jenkins-ci.plugins:durable-task:1.10@jar"
          jenkinsTest "org.jenkins-ci.plugins.workflow:workflow-api:1.13@jar"
          jenkinsTest "org.jenkins-ci.plugins.workflow:workflow-basic-steps:1.13@jar"
          jenkinsTest "org.jenkins-ci.plugins.workflow:workflow-cps:1.13@jar"
          jenkinsTest "org.jenkins-ci.plugins.workflow:workflow-durable-task-step:1.13@jar"
          jenkinsTest "org.jenkins-ci.plugins.workflow:workflow-job:1.13@jar"
          jenkinsTest "org.jenkins-ci.plugins.workflow:workflow-scm-step:1.13@jar"
          jenkinsTest "org.jenkins-ci.plugins.workflow:workflow-step-api:1.13@jar"
          jenkinsTest "org.jenkins-ci.plugins.workflow:workflow-support:1.13@jar"
      }
      

      If I make the build.gradle file have the same dependencies as pom.xml,
      then lots of various java.lang.NoClassDefFoundError errors when running the tests.

      Any idea what is going on and why pom.xml dependencies are less than build.gradle?

          [JENKINS-35412] Dependency list not the same for pom.xml and build.gradle using gradle-jpi-plugin

          Craig Rodrigues added a comment - - edited

          daspilker

          I asked this question on https://discuss.gradle.org
          and got a very good response from Francois Ritaly:

          https://discuss.gradle.org/t/converting-from-maven-to-gradle-need-more-specified-dependencies-in-build-gradle-or-tests-fail/18186/2

          Why do the gradle-jpi-plugin examples use artifact-only dependencies?

          In addition to the documentation, I notice that in the source code for the gradle-jpi-plugin, there are a few places which use artifact-only dependencies. Any reason for that?

          Thanks.

          Craig Rodrigues added a comment - - edited daspilker I asked this question on https://discuss.gradle.org and got a very good response from Francois Ritaly: https://discuss.gradle.org/t/converting-from-maven-to-gradle-need-more-specified-dependencies-in-build-gradle-or-tests-fail/18186/2 Why do the gradle-jpi-plugin examples use artifact-only dependencies ? In addition to the documentation, I notice that in the source code for the gradle-jpi-plugin, there are a few places which use artifact-only dependencies. Any reason for that? Thanks.

          Brian Saville added a comment -

          We've run into this as well. I still notice even using the extended syntax (ext: 'jar') it still seems to require declaring the transitive dependencies for some reason.

          Brian Saville added a comment - We've run into this as well. I still notice even using the extended syntax ( ext: 'jar' ) it still seems to require declaring the transitive dependencies for some reason.

          Has been fixed in 0.23.0.

          Daniel Spilker added a comment - Has been fixed in 0.23.0.

            daspilker Daniel Spilker
            rodrigc Craig Rodrigues
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: