Maven 2 Duplicate Class Compilation Error
Contents |
here for a quick overview of the site
Compilation Failure Duplicate Class
Help Center Detailed answers to any questions you might have maven find duplicate classes Meta Discuss the workings and policies of this site About Us Learn more about maven ignore duplicate classes Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Duplicate Class Error In Ant Build
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: Sign up Why would compiler fail on duplicate class if they belong to different packages?
Maven Duplicate Class Warning
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 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
here for a
Error: Duplicate Class: Java
quick overview of the site Help Center Detailed answers to any maven-compiler-plugin questions you might have Meta Discuss the workings and policies of this site About Us Learn more http://stackoverflow.com/questions/13745003/why-would-compiler-fail-on-duplicate-class-if-they-belong-to-different-packages about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow http://stackoverflow.com/questions/19544572/eclipse-maven-plugin-duplicate-class-error is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Eclipse Maven Plugin: Duplicate Class Error up vote 0 down vote favorite I'm trying to deploy my project using Maven in Eclipse, but I am getting a lot of duplicate class errors. Here is my pom.xml: BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Compilation failure /Users/amyers/Applications/clover/mavenbook-examples-1-SNAPSHOT/ch05-simple-web/simple-webapp/target/clover/src-instrumented/com/atlassian/jira/soap/client/PingStringInput.java:[35,7] duplicate class: com.atlassian.jira.soap.client.PingStringInput /Users/amyers/Applications/clover/mavenbook-examples-1-SNAPSHOT/ch05-simple-web/simple-webapp/target/jaxws/wsimport/java/com/atlassian/jira/soap/client/PingServicePortType.java:[23,7] duplicate class: com.atlassian.jira.soap.client.PingServicePortType /Users/amyers/Applications/clover/mavenbook-examples-1-SNAPSHOT/ch05-simple-web/simple-webapp/target/clover/src-instrumented/com/atlassian/jira/soap/client/ObjectFactory.java:[22,7] duplicate class duplicate class: com.atlassian.jira.soap.client.ObjectFactory /Users/amyers/Applications/clover/mavenbook-examples-1-SNAPSHOT/ch05-simple-web/simple-webapp/target/clover/src-instrumented/com/atlassian/jira/soap/client/PingService.java:[21,7] duplicate class: com.atlassian.jira.soap.client.PingService /Users/amyers/Applications/clover/mavenbook-examples-1-SNAPSHOT/ch05-simple-web/simple-webapp/target/jaxws/wsimport/java/com/atlassian/jira/soap/client/package-info.java:[1,0] package com.atlassian.jira.soap.client has already been annotated Cause The jaxws-maven-plugin adds the output directory for the generated sources maven 2 duplicate to the compile source roots. Clover changes the ${project.build.sourceDirectory} to target/clover/src-instrumented when it performs the instrumentation, thus maven ends up having both the original generated code and the instrumented code on the compile path. Resolution Configure the jaxws-maven-plugin to use ${project.build.sourceDirectory} as the but I don't have a duplicate class.. Results 1 to 6 of 6 Thread: Compile Error: Duplicate Class.. (after package) but I don't have a duplicate class.. LinkBack LinkBack URL About LinkBacks Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 04-16-2012,05:19 PM #1 JimmyD Member Join Date Oct 2011 Location New Jersey Posts 44 Rep Power 0 Compile Error: Duplicate Class.. (after package) but I don't have a duplicate class.. This error is really bizarre.. I developed a Library .java file. I wish to package it up. Say the file is : C:\java\ABC\lib.java if I don't have package, it will compile cleanly. However, if I add on the top line: package ABC; it gives a compile error: .\lib.java:7: duplicate class: ABC.lib public class lib { ^ It's just 1 folder 1 .java file. Can't possibly have another lib class in this same package.. Googling doesn't give me helpful information.. The discussion out there mostly focused on "duplication".. I don't have that.. Can someone give me a hand? Thanks! Reply With Quote 04-16-2012,05:30 PM #2 Tolls Moderator Join Date Apr 2009 Posts 12,960 Rep Power 22 Re: Compile Error: Duplicate Class.. (after package) but I don't have a duplicate cla How do you compile? What else is in the directory when you compile? Please do not ask for code as refusal often offends. ** This space for rent ** Reply With Quote 04-16-2012,05:43 PM #3 JimmyD Member Join Date Oct 2011 Location New Jersey Posts 44 Rep Power 0 Re: Compile Error: Duplicate Class.. (after package) but I don't have a duplicate cla Hi Tolls, Thanks for helping me again! Very nice hint! Before I simply do.. c:\java\ABC> javac *.java but after reading your post, I did: c:\java\ABC> javac lib.java the packaged code gets compiled!! In the directory ABC, there are 2 java files. lib.java and its client testlib.java lib.java is a bunch of static functions. testlib.java calls them using lib.testFunction(a,b,c) etc I can sort of guess now what's the difference between the 2 compilation, but I've had no formal experience with packaging code so I wish to hear your insides on why did the error occurred before. Moreover, I have a new problem right now. lib.java is now compiled t