1

I have an ant build.xml file which contains xjc targets.

Apparently the build process works with Ant 1.7.1, but any newer version results in build failure. I'm using the following:

  • ANT 1.9.7
  • Java JDK 1.8.0_171

The exact text of the error message is:

build.xml:96: java.lang.AssertionError: org.xml.sax.SAXParseException; systemId: jar:file:path/lib/jaxb-xjc.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: Failed to read schema document 'xjc.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property.

So, I researched this, and came up with the idea from this question that I needed to specify a command-line argument for the JVM, so I added one at the appropriate location in the build.xml file:

<arg value="-Djavax.xml.accessExternalSchema=all" />

Now, I'm getting a different error, apparently caused by this addition:

build.xml:96: unrecognized parameter -Djavax.xml.accessExternalSchema=all

How do I resolve the initial error so my build doesn't fail with this issue?

theMayer
  • 15,456
  • 7
  • 58
  • 90

1 Answers1

2

Create a file called jaxp.properties and in it include the following content javax.xml.accessExternalSchema=all.

Place this file in your Java directory's jre/lib folder.

Mars
  • 4,677
  • 8
  • 43
  • 65