spring-core dependency version error with a Jenkins Plugin spring-core dependency version error with a Jenkins Plugin jenkins jenkins

spring-core dependency version error with a Jenkins Plugin


If you're picking up dependencies from the Jenkins install rather than from your plugin the solution is actual quite easy to implement. Per the Jenkins documentation, simply add the maven-hpi-plugin to the build in the pom.xml of your Jenkins plugin and set it to load the plugin classes first:

<build>    <plugins>        <plugin>            <groupId>org.jenkins-ci.tools</groupId>            <artifactId>maven-hpi-plugin</artifactId>            <configuration>                <pluginFirstClassLoader>true</pluginFirstClassLoader>            </configuration>        </plugin>    </plugins></build>


Try to "shade" the CF client lib using the Maven Shade plugin, as it seems Jenkins doesn't like plugins that are using a different version of Spring than the one it uses internally itself.

Even if your own plugin doesn't use Spring directly, but the CF library does, I believe this still applies. The person that suggested shading in the jenkinsci-dev mailing list seems to be involved in Jenkins plugins development, so he might know about this more than others.

These being said, I would get the source code for cf-client-lib, I would change the pom.xml to consider shading for org.springframework package, as well (because cf-client-lib already uses shading for org.codehaus.jackson package) and I would use this "shaded" version of cf-client-lib in the Jenkins plugin.