MAVEN PLUGIN(S) SERIES - Find duplicate classes or resources
Maven Duplicate Finder Plugin
com.ning.maven.plugins:maven-duplicate-finder-plugin:1.0.2:check
This plugin helps to find duplicate classes and/or resources within project's dependencies. It's very straightforward to useFrom command line
mvn com.ning.maven.plugins:maven-duplicate-finder-plugin:1.0.2:check
Include in normal build
<plugin> <groupId>com.ning.maven.plugins</groupId> <artifactId>maven-duplicate-finder-plugin</artifactId> <executions> <execution> <phase>verify</phase> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin>
Configuration
There are several option that make this plugin very flexible:
- It is possible break the build upon duplicate detection
- It is possible add exceptions (i.e. allow duplicate classes or resources for specific artifacts)
- It is possible ignore dependencies from check
Output sample
[WARNING] Found duplicate classes in [commons-logging:commons-logging:1.1.1,commons-logging:commons-logging-api:1.1] : [WARNING] org.apache.commons.logging.Log [WARNING] org.apache.commons.logging.LogConfigurationException [WARNING] org.apache.commons.logging.LogFactory [WARNING] org.apache.commons.logging.LogSource [WARNING] org.apache.commons.logging.impl.Jdk14Logger [WARNING] org.apache.commons.logging.impl.LogFactoryImpl [WARNING] org.apache.commons.logging.impl.NoOpLog [WARNING] org.apache.commons.logging.impl.SimpleLog [WARNING] org.apache.commons.logging.impl.WeakHashtable [WARNING] Found duplicate resources in [org.springframework:spring-aop:3.0.3.RELEASE,org.springframework:spring-beans:3.0.3.RELEASE,org.springframework:spring-context:3.0.3.RELEASE,org.springframework:spring-core:3.0.3.RELEASE] : [WARNING] overview.html [WARNING] Found duplicate resources in [org.springframework:spring-aop:3.0.3.RELEASE,org.springframework:spring-beans:3.0.3.RELEASE,org.springframework:spring-context:3.0.3.RELEASE] : [WARNING] META-INF/spring.tooling
License
License is Apache License Version 2.0
Comments
Post a Comment