Maven Compilation Error Duplicate Class
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies maven find duplicate classes of this site About Us Learn more about Stack Overflow the company duplicate class error in ant build Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges maven ignore duplicate classes Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: maven duplicate class warning 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 errors: [ERROR] Failed to
Maven Remove Duplicate Dependencies
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,80952854 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 901k48765407467 Thanks. It's not clear to me ei
Sign
Error: Duplicate Class: Java
in Pricing Blog Support Search GitHub maven-compiler-plugin This repository Watch 50 Star 262 Fork 84 google/closure-templates Code Issues jaxb2-maven-plugin 43 Pull requests 2 Projects 0 Pulse Graphs New issue running mvn compile twice without a clean causing http://stackoverflow.com/questions/13745003/why-would-compiler-fail-on-duplicate-class-if-they-belong-to-different-packages 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 participants jmhodges commented Jul 12, https://github.com/google/closure-templates/issues/46 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/src/github.com/google/closure-templates/target/generated-sources/annotations/com/google/template/soy/soytree/AutoValue_ForNode_RangeArgs.java:[9,7] duplicate class: com.google.template.soy.soytree.AutoValue_ForNode_RangeArgs [ERROR] /Users/jmhodges/src/github.com/google/closure-templates/target/generated-sources/annotations/com/google/template/soy/soytree/AutoValue_TemplateDelegateNode_DelTemplateKey.java:[7,7] duplicate class: com.google.template.soy.soytree.AutoValue_TemplateDelegateNode_DelTemplateKey [ERROR] /Users/jmhodges/src/github.com/g