Open dresnick-sf opened 3 years ago
Dear @carstenlenz, @dresnick-sf, @daspilker and @jamietanna,
firstly, I would like to thank you for conceiving and maintaining the excellent Job DSL plugin and Gradle Job DSL support plugin. What would Jenkins be without it!
Then, we wanted to report back that we are observing the same issue as outlined at JENKINS-65341 and reported by @dresnick-sf here. In order to be able to reproduce it without efforts, we created a repository at ^1. Maybe this can be a common ground for further investigations.
Unfortunately, we have not been able to successfully apply the workaround outlined within JENKINS-65341. Any hints on how to make that work would be greatly appreciated.
Thank you already for taking the time to look into this!
With kind regards, Andreas.
I was able to get it to work with newest version of Jenkins by using io.spring.dependency-management
plugin to exclude xstream
module. I feel like there is a better way to do that without using additional plugin but this worked for me.
build.gradle
plugins {
id 'com.aoe.jenkins-job-dsl' version '2.9.0'
id "io.spring.dependency-management" version "1.0.12.RELEASE"
}
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module("org.jenkins-ci.main:jenkins-war") because "Jenkins In Use" with module("org.jenkins-ci.main:jenkins-war:${jenkinsVersion}")
substitute module("org.codehaus.groovy:groovy-all") because "The matching groovy version for the Jenkins" with module("org.codehaus.groovy:groovy-all:${groovyVersion}")
}
}
dependencyManagement {
dependencies {
dependency("org.jenkins-ci.plugins:job-dsl-core:${jobDslVersion}") {
exclude 'org.jvnet.hudson:xstream'
}
}
}
jobDsl {
version = jobDslVersion
}
gradle.properties
jobDslVersion=1.80
jenkinsVersion=2.346.1
# Groovy version used in target Jenkins env:
# Run `println GroovySystem.version` in script console to get the version
groovyVersion=2.4.21
@xsaero00 thanks a lot for the provided solution, it worked for me. Below is a snippet that does the same thing but for Maven:
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>job-dsl-core</artifactId>
<version>1.80</version>
<exclusions>
<exclusion>
<groupId>org.jvnet.hudson</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
Using
id 'com.aoe.jenkins-job-dsl' version '2.9.0'
Encountering this error after trying to upgrade Jenkins
It looks like this is caused by JENKINS-65341. This has a simple workaround which I have not tried.
The full error