Build Failure in Jenkins, Found duplicate resources Build Failure in Jenkins, Found duplicate resources jenkins jenkins

Build Failure in Jenkins, Found duplicate resources


Background/Details

I had a similar issue and this threw me for a loop for a while and I started to question my maven knowledge and did some digging. If you want to learn more about duplicate finder, you can read the readme on their github: https://github.com/ning/maven-duplicate-finder-plugin

For the project I was on, I determined I could do excludes in the dependencies or add exceptions to the duplicate finder. I saw both in my project and wondered when it was appropriate to do which.

The message from the plugin helps identify where duplication resides. You'll normally see this when you try to add new dependencies. When you see that, there are two options, either exclude things from the dependencies, or create exceptions in your com.ning.maven.plugins:duplicate-finder-maven-plugin configuration.

Summary / Conclusion

Adding an exception, just ignores the problem. So the cleaner way is add the excludes in the dependencies. This way you get exactly what you expect/desire. Furthermore, going down the exception route would just add a ton of extra work that isn't really useful. So the intent of the plugin is to help you identify duplications, then try to handle them via excludes in the dependencies.

Example of How to Do Exclude

In your example/case, one of the following should work for you:

<dependency>    <groupId>com.jayway.restassured</groupId>    <artifactId>rest-assured</artifactId>    <version>2.4.0</version>    <exclusions>        <exclusion>            <groupId>org.codehaus.groovy</groupId>            <artifactId>groovy-json</artifactId>        </exclusion>    </exclusions></dependency>

or

<dependency>    <groupId>com.jayway.restassured</groupId>    <artifactId>rest-assured</artifactId>    <version>2.4.0</version>    <exclusions>        <exclusion>            <groupId>org.codehaus.groovy</groupId>            <artifactId>groovy</artifactId>        </exclusion>    </exclusions></dependency>


It is likely that your new dependency is failing on this test your are doing via Maven (duplicate-finder-plugin). Run the manual check from command line (on the level of the POM file) to find out what are the offending classes:

mvn com.ning.maven.plugins:duplicate-finder-maven-plugin:1.0.4:check

Then you can either remove the dependency or configure the Maven plugin to ignore these. (config here)


What you can do is to follow the rule of scope, meaning that, separate dependencies according to their scopes, such as in your case, rest assured used for testing, why not to put it under the scope of a test:

<scope>test</scope>

Secondary, what I usually do is executing exactly same commands from Jenkins on my local machine and usually it does help, from you error log I think it is not rest assured related, so please try to run MVN goal which is on Jenkins side locally and make sure you have the same error. If not, it can be a different configuration of maven for example via settings.xml in Jenkins machine.