*
The moose likes IDEs, Version Control and other tools and the fly likes eclipse, two projects having a java class with same qualified.classname, how to ignore one in build? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "eclipse, two projects having a java class with same qualified.classname, how to ignore one in build?" Watch "eclipse, two projects having a java class with same qualified.classname, how to ignore one in build?" New topic
Author

eclipse, two projects having a java class with same qualified.classname, how to ignore one in build?

Juan Rolando Prieur-Reza
Ranch Hand

Joined: Jun 20, 2003
Posts: 236
I have two projects in eclipse (using either Kepler or recent Juno, with or without Maven plugin).

In each project there is a class named as in (for sample) com.mymy.Worker.java .
This prevents compilation.

Is there a way to tell eclipse which one to ignore? [preferred solution]

Is it possible to make Maven "see" one class during a particular phase sequence (e.g. compile, test) and the other class during another phase (e.g. compile, test, package) ?

[ obviously I could rename one of them or delete one from one of the projects but that would create other problems. ]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

Having two different classes with the exact same fully qualified name in two different JARs is not a good idea, there is really no way to handle such a think easily. If you were dealing with javac or the java runtime directly, you could order the JARs in the classpath in such a way as to get the JAR (or directory) with the desired class to be earlier in the classpath. But with Eclipse and Maven you don't have that low level control over the classpath.

Why do you have two classes with the same fully qualified name? Perhaps if we knew that we could come up with a better scheme to accomplish the same goal (off hand I would say you probably want to use a factory pattern but it is hard to say without knowing your requirements.)


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: eclipse, two projects having a java class with same qualified.classname, how to ignore one in build?