Wednesday, October 19, 2016

Maven Dependancy Exclusion

Consider the case where you are using the Log4J2 however the logger you are trying to add into the file brings in log4j1.x.

You are missing a bunch of new functionality because logger still refers to old version.

Obvious so you need to remove the Transitive dependency but how to identify the transitive dependencies

mvn dependency:tree -Dverbose -Dincludes=log4j:log4j


will show you the dependency-tree, but only the relevant excerpt. Using this information you can now add your exclusions to the affected pom.xml files


<!-- CXF Dependancies --><dependency>

Then you can enforce that the dependency needs to be some version and above 

                                    <!-- exclude all versions lower than 1.2.17-->                                   
Finally run a Maven Site plugin to generate the Dependancy site.
IF you follow the steps it POM should be clean by now.

No comments:

Post a Comment