I have a project where I want to work with a set of Classes generated by JAXB from an XSD. With these classes I would like to marshall/unmarshall from XML and JSON.
I've figured out I would need Moxy Eclipselink to do what I need. I tested my classes and process as an Ant project, then I decided to move it over to Maven for better management.
However, the jaxb.properties file does not seem to be recognized at runtime.
My project has a Maven artifact for the objects, and another artifact for the logic/processing. I've been pulling my hair out trying to figure out where to put the jaxb.properties so it could be read.
I have tried
Objects Project
/src/main/resources/jaxb.properties
/src/main/java/[namespace]/jaxb.properties
Logic Project
/src/main/resources/jaxb.properties
/src/main/java/[namespace]/jaxb.properties
However, when I try to get the classname of my JAXBContext I still get:
class com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl
If I modify my run settings by specifying a JVM option of:
-Djavax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
I get:
class org.eclipse.persistence.jaxb.JAXBContext
In both projects I have specified this in the pom.xml
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</build>
If I look at the JAR, I see jaxb.properties in there.
Now I'm confused.
Example, in maven the java class
src\main\java\com\example\sitemap\generate\domain
and the file jaxb.properties
src\main\resources\com\example\sitemap\generate\domain\jaxb.properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With