• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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. ]
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.)
 
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic