繁体   English   中英

如何使用最新的JVM构建xerces-j 2.11?

[英]How to build xerces-j 2.11 with an up-to-date JVM?

我已经从https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_2_11_0签出xerces-j 2.11。 现在,我想构建它,但是在编译过程中出现以下错误:

compile:
   [xjavac] Compiling 596 source files to C:\Users\abrieg\workingcopy\xerces-trunk\build\classes
   [xjavac] C:\Users\abrieg\workingcopy\xerces-trunk\build\src\org\apache\html\dom\HTMLFrameElementImpl.java:28: error: HTMLFrameElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLFrameElement
   [xjavac] public class HTMLFrameElementImpl
   [xjavac]        ^
   [xjavac] C:\Users\abrieg\workingcopy\xerces-trunk\build\src\org\apache\html\dom\HTMLIFrameElementImpl.java:28: error: HTMLIFrameElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLIFrameElement
   [xjavac] public class HTMLIFrameElementImpl
   [xjavac]        ^
   [xjavac] C:\Users\abrieg\workingcopy\xerces-trunk\build\src\org\apache\html\dom\HTMLObjectElementImpl.java:28: error: HTMLObjectElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLObjectElement
   [xjavac] public class HTMLObjectElementImpl
   [xjavac]        ^
   [xjavac] Note: Some input files use or override a deprecated API.
   [xjavac] Note: Recompile with -Xlint:deprecation for details.
   [xjavac] Note: Some input files use unchecked or unsafe operations.
   [xjavac] Note: Recompile with -Xlint:unchecked for details.
   [xjavac] 3 errors

问题是,xjavac任务不会从使用的类/tools/xml-apis.jar而是使用rt.jar的JDK。 编译在以下VM中运行:

java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

我已经使用认可的库覆盖机制将xerces-j 2.11的xml-apis.jar放入虚拟机中,但这没有用。

xjavac调用定义为

<xjavac srcdir="${build.src}"
       destdir="${build.dest}"
       source="${javac.source}"
       target="${javac.target}"
       classpath="${build.dir}/classes:${tools.dir}/${jar.apis}:${tools.dir}/${jar.resolver}:${tools.dir}/${jar.serializer}"
       debug="${debug}"
       debuglevel="${debuglevel}"
       deprecation="${deprecation}"
       optimize="${optimize}"
       includeAntRuntime="false"
       includeJavaRuntime="false"
       excludes="org/xml/sax/** 
            javax/xml/**
            org/w3c/dom/*
            org/w3c/dom/bootstrap/**
            org/w3c/dom/events/**
            org/w3c/dom/ls/**
            org/w3c/dom/html/**
            org/w3c/dom/ranges/**
            org/w3c/dom/traversal/**
            org/w3c/dom/views/**
            org/w3c/dom/xpath/**"
       />

如何确保使用xml-apis.jar而不是JVM中的类进行编译?

您需要将前面加上 xml-apis.jar自举类中的javac的。

<xjavac srcdir="${build.src}"
       destdir="${build.dest}"
       source="${javac.source}"
       target="${javac.target}"
       classpath="${build.dir}/classes:${tools.dir}/${jar.apis}:${tools.dir}/${jar.resolver}:${tools.dir}/${jar.serializer}"
       debug="${debug}"
       debuglevel="${debuglevel}"
       deprecation="${deprecation}"
       optimize="${optimize}"
       includeAntRuntime="false"
       includeJavaRuntime="false"
       excludes="org/xml/sax/** 
            javax/xml/**
            org/w3c/dom/*
            org/w3c/dom/bootstrap/**
            org/w3c/dom/events/**
            org/w3c/dom/ls/**
            org/w3c/dom/html/**
            org/w3c/dom/ranges/**
            org/w3c/dom/traversal/**
            org/w3c/dom/views/**
            org/w3c/dom/xpath/**"
       >
       <compilerarg line="-Xbootclasspath/p:${tools.dir}/${jar.apis}"/>
</xjavac>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM