How to specify javax.xml.accessExternalSchema for the JAXB2 Maven plugin

Josh picture Josh · Oct 13, 2014 · Viewed 31.7k times · Source

I have a maven plugin (jaxb2) and I need to supply a jvm arg to it. I don't think there is a tag to add jvm args in the pom for it.

I know I can pass in jvm args on the command line eg: mvn clean install -Djavax.xml.accessExternalSchema=all

Is it possible to set this jvm arg in the pom so that I don't have to type it into the command line every time?

(As aside - this jvm arg is required in order for it to work with JAVA-8. It works fine with JAVA-7)

Answer

lexicore picture lexicore · Oct 14, 2014

This is relevant to the new XML security properties in JAXB 1.5, introduced in Java 8. This is why your builds now fail on Java 8 but work with Java 7.

If you're using my maven-jaxb2-plugin, please upgrade to the version 0.9.0 or later (current is 0.10.0). It has now a accessExternalSchema switch (default is all).

This sets precisely javax.xml.accessExternalSchema=all.

Please see the documentation.