java 8 中使用Ant的 wsimport 任务

    <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
      <classpath refid="metro.classpath"/>
    </taskdef>


在使用ant构建时,抛出异常:

java.lang.AssertionError: org.xml.sax.SAXParseException; systemId: ... schema_reference:
Failed to read schema document 'xjc.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property.

解决办法: 在 path/to/jdk8/jre/lib下面添加一个jaxp.properties的文件,内容为:

javax.xml.accessExternalSchema = all

参考文献:http://docs.oracle.com/javase/7/docs/api/javax/xml/XMLConstants.html#ACCESS_EXTERNAL_SCHEMA

你可能感兴趣的:(jdk8,wsimport)