I always have some of the most obscure problems, and often I'll find similar problems but ones not applicable to my actual problem...
Anyways, I'm having an issue with M2Eclipse showing an error in Eclipse. Currently, my POM.xml
references xml-apis:xml-apis
of some version (yes, I'm aware of the issue with Xerces), and apparently, xml-apis
replaces and not overrides classes in the JDK. One specific example of such is org.w3c.dom.Element
in rt.jar
in the JDK; this class exists, but xml-apis
has a class with the same name and package structure, effectively replacing it -- or so Eclipse thinks.
What makes this bad for me is that since xml-apis
replaces this implementation instead of overriding it, there are references in the code (which I've been tasked with migrating from Ant to Maven, where you could just change the build order and Eclipse would stop having a whinge) where the libraries to not match up... For example, Element e; e.getTextContext();
would yield an error such that "The method getTextContent() is undefined for the type Element
." This error only shows in the editor and the Problems window in Eclipse, though. But Maven compiles it just fine... So why is Eclipse showing an error?
To the best of my knowledge, there's no way to change the build order in a Maven project in Eclipse to make it stop doing this. Does anyone have any solutions for this?
For reference (if it matters, which I doubt) I'm running Windows 7 Professional, compiling with JDK 1.6, and I'm using Maven 3.0.4.
select your project > right click > properties > java build path > order and export > select JRE entry and hit down
here you can control order of classpath entries, so if you want your jar from maven get picked up first move it to before JRE 's entry