具体错误:
[INFO] Loading inherited module 'org.teavm.samples.benchmark.benchmark' [INFO] [ERROR] Failure while parsing XML [INFO] org.xml.sax.SAXNotRecognizedException: unrecognized feature http://apache.org/xml/features/nonvalidating/load-external-dtd [INFO] at org.gjt.xpp.sax2.Driver.setFeature(Driver.java:178) [INFO] at org.gjt.xpp.jaxp11.SAXParserImpl.setFeatures(SAXParserImpl.java:149) [INFO] at org.gjt.xpp.jaxp11.SAXParserImpl.<init>(SAXParserImpl.java:132) [INFO] at org.gjt.xpp.jaxp11.SAXParserFactoryImpl.newSAXParserImpl(SAXParserFactoryImpl.java:114) [INFO] at org.gjt.xpp.jaxp11.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:142) [INFO] at com.google.gwt.dev.util.xml.ReflectiveParser.createNewSaxParser(ReflectiveParser.java:61) [INFO] at com.google.gwt.dev.util.xml.ReflectiveParser.access$000(ReflectiveParser.java:48) [INFO] at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:345) [INFO] at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:70) [INFO] at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:431) [INFO] at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:316) [INFO] at com.google.gwt.dev.cfg.ModuleDefLoader.load(ModuleDefLoader.java:243) [INFO] at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:193) [INFO] at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromResources(ModuleDefLoader.java:151) [INFO] at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:126) [INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:139) [INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:118) [INFO] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55) [INFO] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50) [INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:125)
- 解决办法一(无效)
在编译脚本中,加入:
JAVA_OPTIONS="${JAVA_OPTIONS} -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl" export JAVA_OPTIONS
解决办法二(有效)
看到一篇文章,受到启发(大哥你这还好意思说自己是首发?,标题不一样嘛,哈哈):
https://blog.csdn.net/SCTOM/article/details/83100430
在pom.xml中,把xercesImpl置于所有jar之前。具体来说:
/
<dependencies> <dependency> <groupId>org.apache.xerces</groupId> <artifactId>xercesImpl-2.12.0</artifactId> <version>2.12.0</version> <scope>system</scope> <systemPath>${HOME}/.m2/repository/xerces/xercesImpl/2.12.0/xercesImpl-2.12.0.jar</systemPath> </dependency> 。。。。。。