ant build Oxygen Dita-Ot中java类路径出错

时间:2016-12-01 06:41:38

标签: java xml ant build dita

嗨,即使包含jdk路径位置后,我也收到此错误。它显示

Expected to find it in C:\Program Files\Java\jre1.8.0_111\lib\tools.jar

生成此cmd代码

C:\Program Files\Oxygen XML Editor 17\frameworks\dita\DITA-OT2.x>ant -f integrator.xml
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.0_111\lib\tools.jar
Buildfile: C:\Program Files\Oxygen XML Editor 17\frameworks\dita\DITA-OT2.x\integrator.xml

strict:

integrate:

BUILD FAILED
C:\Program Files\Oxygen XML Editor 17\frameworks\dita\DITA-OT2.x\integrator.xml:66: The following error occurred while executing this line:
C:\Program Files\Oxygen XML Editor 17\frameworks\dita\DITA-OT2.x\integrator.xml:44: javax.xml.transform.TransformerFactoryConfigurationError: Provider net.sf.saxon.TransformerFactoryImpl not found
        at javax.xml.transform.FactoryFinder.newInstance(Unknown Source)
        at javax.xml.transform.FactoryFinder.find(Unknown Source)
        at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
        at org.dita.dost.platform.Integrator.writePlugins(Integrator.java:514)
        at org.dita.dost.platform.Integrator.integrate(Integrator.java:207)
        at org.dita.dost.platform.Integrator.execute(Integrator.java:200)
        at org.dita.dost.platform.IntegratorTask.execute(IntegratorTask.java:40)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
        at org.apache.tools.ant.Main.runBuild(Main.java:851)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.ClassNotFoundException: net/sf/saxon/TransformerFactoryImpl
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at javax.xml.transform.FactoryFinder.getProviderClass(Unknown Source)
        ... 38 more

Total time: 0 seconds

类路径或积分器xml文件是否有问题?我按照氧气dita-ot网站和书中给出的步骤进行了操作。

我认为问题出在本节

 C:\Program Files\Oxygen XML Editor 17\frameworks\dita\DITA-OT2.x\integrator.xml:66: The following error occurred while executing this line:
C:\Program Files\Oxygen XML Editor 17\frameworks\dita\DITA-OT2.x\integrator.xml:44: javax.xml.transform.TransformerFactoryConfigurationError: Provider net.sf.saxon.TransformerFactoryImpl not found

积分器的我的行号(44,66)说这个,我无法理解。

44  <integrate ditadir="${dita.dir}" strict="${strict}"/>

65<target name="strict" description="Run integration in strict mode">
  66  <antcall target="integrate">
    67  <param name="strict" value="true"/>
    68</antcall>
  69</target>

3 个答案:

答案 0 :(得分:0)

tools.jar只存在于JDK包中,而不是存在于JRE包中。您需要下载JDK8软件包并进行安装,然后将系统属性(JAVA_HOME和PATH)链接到新的JDK安装目录路径。

JDK8 download

毕竟,请重新运行命令。

答案 1 :(得分:0)

您正尝试从命令行运行integrator.xml,错误消息显示Saxon不在类路径中。

通常oXygen用户通过管理员权限调用oXygen并选择&#34; Document&#34; - &#34;转型&#34; - &#34;配置转换场景&#34; - &#34;运行DITA OT Integrator&#34;。

Transformation Scenario

Executing:
"c:\program files\oxygen xml editor 18.1\jre/bin/java" -Xmx256m -classpath "C:\Program Files\Oxygen XML Editor 18.1\tools\ant/lib/ant-launcher.jar" "-Dant.home=C:\Program Files\Oxygen XML Editor 18.1\tools\ant" org.apache.tools.ant.launch.Launcher -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\ant-apache-resolver-1.9.4.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\ant-launcher.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\ant.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\commons-codec-1.9.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\commons-io-2.4.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\dost-configuration.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\dost-patches.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\dost.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\guava-19.0.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\jsearch.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\xml-apis-1.4.01.jar" -lib "C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\xml-resolver-1.2.jar" -f "C:\Program Files\Oxygen XML Editor 18.1\frameworks/dita/DITA-OT2.x/integrator.xml" "-Dstrict=true" "-Dwebhelp.trial.license=no"

Buildfile: C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\integrator.xml

strict:

integrate:
      [jar] Building jar: C:\Program Files\Oxygen XML Editor 18.1\frameworks\dita\DITA-OT2.x\lib\dost-configuration.jar

BUILD SUCCESSFUL
Total time: 9 seconds

The process finished with exit code: 0

此方法可以解决您的问题。

答案 2 :(得分:0)

您的代码显示您使用的是DITA OT的2.x版本。但是您使用的是Integrator命令用于较旧的OT版本。

您可以使用Oxygen运行积分器,但如果您想从命令行运行它,请执行以下操作:

  1. 以管理员身份打开命令窗口:按“开始”,键入cmd,当cmd.exe出现时,右键单击它并选择“以管理员身份运行”。
  2. 导航到Oxygen 2.x DITA OT:

    C:\ Program Files \ Oxygen XML Editor 17 \ frameworks \ dita \ DITA-OT2.x

  3. 输入以下命令:

    bin \ dita -install

  4. 如果它返回到没有错误的提示,你应该好好去。

    顺便说一下,tools.jar错误通常不用担心。