-
Improvement
-
Resolution: Fixed
-
Minor
-
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