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

Dependency on job-dsl-core may cause unexpected compilation errors

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • job-dsl-plugin
    • None

      A plugin module which declares org.jenkins-ci.plugins:plugin as a parent and includes a dependency to job-dsl may experience compilation errors when importing XStream classes.

      See related thread here.

      This appears to be caused by the xstream dependency being placed in "runtime" scope when depending on job-dsl. Without the job-dsl dependency, its scope is "provided", which is derived from the upstream jenkins-core module.

      Workarounds include:

      • Placing an exclusion for xstream within the job-dsl dependency declaration.
      • Declaring a direct dependency on xstream, specifying a scope of provided.

      The attached project demonstrates the issue as well as the above workarounds using profiles:

      $ mvn compile # successful
      $ mvn compile -Pjob-dsl-dependency # introduces dsl dependency, compile fails with 'error: cannot access XStream'
      # above workarounds:
      $ mvn compile -Pusing-exclusion
      $ mvn compile -Pspecified-xstream
      

            daspilker Daniel Spilker
            prospero238 Keith Collison
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: