How to make XmlBeans play nicely with eclipse (and the maven-eclipse-plugin) – Education Career Blog

The XmlBeans Eclipse plugin seems moribund, last released a long time ago.

Meanwhile, when you run XmlBeans on an XSD, what comes out is not just Java source code, but also binary classes. I can’t figure out how to get Eclipse to include those classes in the classpath when running code that uses the resulting API, and the result is class not found errors.

of course, if I just put a jar containing the results into the classpath, that works, but that’s not desirable, since the maven-eclipse-plugin likes to pull the xmlbean-bearing class into the workspace along with everything else.

Is there a recipe for configuring Eclipse (or XMLBeans) to get around this?

,

You can include plain .class files in Eclipse classpath like this:

Project properties -> Java Build Path -> Libraries -> Add Class Folder…

Unfortunately, AFAIK, maven-eclipse-plugin does not support adding this option and you will lose the change when you re-generate the .classpath file.

If you feel like adding this feature to the plugin, MECLIPSE-164 seems like a good starting point. 😉

Leave a Comment