Duplicate Class Error In Maven Build
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and maven duplicate class finder policies of this site About Us Learn more about Stack Overflow the
Duplicate Class Error In Ant Build
company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags maven build error in opening zip file Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only maven build error cannot find symbol takes a minute: Sign up Why would compiler fail on duplicate class if they belong to different packages? up vote 0 down vote favorite I got this inherited project using Maven/m2e as the build automation tool. All nice & cool except that this project, checked out of SVN as is, is broken... meaning it fails to build, with several duplicate class
Maven Build Error Package Does Not Exist
errors: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.1:compile (default-compile) on project myproj: Compilation failure: Compilation failure: [ERROR] \Users\Daniel\workspace\myproj\target\generated-sources\cxf\org\package1\services\ClassA.java:[36,7] duplicate class: org.package1.services.ClassA Now, it's true that ClassA exists in the build environment 3 times: c:/Users/Daniel/workspace/myproj/src/main/java/org/package1/services/ClassA.java c:/Users/Daniel/workspace/myproj/src/main/java/org/package1/www/services/ClassA.java c:/Users/Daniel/workspace/myproj/target/generated-sources/cxf/org/package1/services/ClassA.java But they belong to different packages: package org.package1.services; package org.package1.www.services; So, why would the compiler complain about a duplicate class? (Or is it Maven that's complaining?) I am not familiar with the design considerations of the original author, so any idea how to resolve these duplicates would be much appreciated. java maven m2e share|improve this question asked Dec 6 '12 at 13:51 Withheld 1,80442854 add a comment| 3 Answers 3 active oldest votes up vote 4 down vote accepted You've got three classes, in two packages. Therefore two of the classes are in the same package. These two files: .../myproj/src/main/java/org/package1/services/ClassA.java .../myproj/target/generated-sources/cxf/org/package1/services/ClassA.java ... are both contributing org.package1.services.ClassA (which is the fully-qualified class name the compiler is complaining about, note). It's not clear which one you should be using, based on the information you've given. share|improve this answer answered Dec 6 '12 at 13:55 Jon Skeet 899
Sign in Pricing Blog Support Search maven find duplicate classes GitHub This repository Watch 48 Star 260 Fork 84
Maven Ignore Duplicate Classes
google/closure-templates Code Issues 42 Pull requests 1 Projects 0 Pulse Graphs New issue running mvn compile twice http://stackoverflow.com/questions/13745003/why-would-compiler-fail-on-duplicate-class-if-they-belong-to-different-packages without a clean causing duplicate classes #46 Open jmhodges opened this Issue Jul 12, 2015 · 5 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 2 https://github.com/google/closure-templates/issues/46 participants jmhodges commented Jul 12, 2015 The current build breaks when mvn compile is run twice with no mvn clean between. I've not been able to figure out what is going wrong. I did find a hack that works where you add -proc:none to the javac compiler arguments and also add an old maven-processor-plugin to the pom, but that seems.. well, silly. Here's the errors: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project soy: Compilation failure: Compilation failure: [ERROR] /Users/jmhodges/src/github.com/google/closure-templates/target/generated-sources/annotations/com/google/template/soy/shared/AutoValue_SoyAstCache_VersionedFile.java:[9,7] duplicate class: com.google.template.soy.shared.AutoValue_SoyAstCache_VersionedFile [ERROR] /Users/jmhodges/src/github.com/google/closure-templates/target/generated-sources/annotations/com/google/template/soy/jbcsrc/AutoValue_ControlFlow_IfBlock.java:[7,7] duplicate class: com.google.template.soy.jbcsrc.AutoValue_ControlFlow_IfBlock [ERROR] /Users/jmhodges/src/github.com/google/closure-templates/target/generated-sources/annotations/com/google/template/soy/jbcsrc/AutoValue_FieldRef.java:[8,7] duplicate class: com.google.template.soy.jbcsrc.AutoValue_FieldRef [ERROR] /Users/jmhodges/src/github.com/google/closure-templates/target/generated-sources/annotations/com/google/template/soy/jssrc/internal/AutoValue_HelperFunctions_FieldAccessStrategy.java:[7,7] duplicate class: com.google.template.soy.jssrc.internal.AutoValue_HelperFunctions_FieldAccessStrategy [ERROR] /Users/jmhodges
due to MCOMPILER-157 when compiler is called twice or moreAgile Board ExportXMLWordPrintableJSON Details Type: Bug Status: Closed Priority: Major Resolution: Fixed Affects Version/s: 3.2 Fix Version/s: 3.5.1 Labels: None Environment: Maven 3.2.3 Description I tried to upgrade our projects to use the compiler 3.2 and instead of 3.1 Classical builds are ok but site builds are KO because for various reasons (reports) the lifecycle is forked and thus the compiler is called twice (or more) and fails because it finds duplicated classes Example : [INFO] ------------------------------------------------------------------------ [INFO] Building eXo Commons - Common Services 4.1.x-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-java-version) @ commons-component-common --- [INFO] [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven-version) @ commons-component-common --- [INFO] [INFO] --- buildnumber-maven-plugin:1.3:create (default) @ commons-component-common --- [INFO] [INFO] --- jacoco-maven-plugin:0.7.2.201409121644:prepare-agent (prepare-ut-agent) @ commons-component-common --- [INFO] argLine set to -javaagent:/srv/ciagent/workspace/commons-master-site/.repository/org/jacoco/org.jacoco.agent/0.7.2.201409121644/org.jacoco.agent-0.7.2.201409121644-runtime.jar=destfile=/srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/jacoco.exec,append=true [INFO] [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ commons-component-common --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] Copying 5 resources [INFO] [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ commons-component-common --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 97 source files to /srv/ciagent/workspace/commons-master-site/sources/commons-component-common/target/classes [WARNING] Supported source version 'RELEASE_5' from annotation processor 'org.chromattic.apt.ChromatticProcessor' less than -source '1.7' [INFO] About to process the type org.exoplatform.settings.chromattic.SettingsRoot [INFO] About to process the type org.exoplatform.settings.chromattic.SubContextEntity [INFO] About to process the type org.exoplatform.settings.chromattic.SimpleContextEntity [INFO] About to process the type org.exoplatform.settings.chromattic.ScopeEntity [INFO] About to process t