The error occurs because you have configured maven-enforcer-plugin which restricts the build with duplicate classes , You can see the following configuration in your pom file <plugin><artifactId>maven-enforcer-plugin</artifactId><configuration><rules><banDuplicateClasses></banDuplicateClasses></rules> </configuration></plugin>

ResolutionResolution # 1 - Ignore Duplicates - Within the plugin configuration , you can specify the class / classes that should be ignored. For example -Ignoring a particular class duplicates <plugin><artifactId>maven-enforcer-plugin</artifactId><configuration><rules><banDuplicateClasses><dependencies><dependency><groupId>Module 1 group</groupId><artifactId>Module 1 artifatc</artifactId><ignoreClasses><ignoreClass>abc.class</ignoreClass></ignoreClasses></dependency></dependencies></banDuplicateClasses></rules> </configuration></plugin>Ignoring multiple classes duplicates <plugin><artifactId>maven-enforcer-plugin</artifactId><configuration><rules><banDuplicateClasses><dependencies><dependency><groupId>Module 1 group</groupId><artifactId>Module 1 artifatc</artifactId><ignoreClasses><ignoreClass>org.alphaPackage.*</ignoreClass></ignoreClasses></dependency></dependencies></banDuplicateClasses></rules> </configuration></plugin>The obove resolution only ignores the duplicates during Build but won't help in the runtime issue that might arise at runtime due to those duplicatesResolution # 2 - Don't allow duplicates in the Build by excluding them.Identify which jar you want and which one you would like to exclude ( groupxxx:artifactxxx or groupyyyy:artifactyyyy )Go to the project pom directory and do mvn dependency:tree and locate the jar file which you would like to excludeIf it's a direct dependency, simply remove that dependency from the pom file configuration.If it's a transitive dependency, first identify the direct dependency and then add exclusion config in the pom file like following<dependency> <groupId>DirectDependency Group</groupId> <artifactId>DirectDependency Artifact</artifactId>= <exclusions> <exclusion> <artifactId>groupyyyy</artifactId> <groupId>artifactyyyy</groupId> </exclusion> </exclusions></dependency>This config will not allow project / jar groupyyyy:artifactyyyy to be included in the current build and hence it won't complain about the duplicate.

Total Site Views

Contact Us - Send us Technical Queries - We will be happy to help.

Disclaimer:
The intent of the site is to help students and professional in their academics and career.Though best effort are made to present the most accurate information, No guarantees are made regarding the accuracy or usefulness of content.The site holds no responsibility of any harm to anyone because of provided information.

This site contains some content ( interview questions ) submitted by users. If you have any concern regarding the copyright of the content, Contact us with the original reference and the content will be removed.