当前位置: 首页 > 知识库问答 >
问题:

DITA OpenToolkit 2.1.1版本。运行ANT脚本时出现xml“BUILD FAILED”错误

廖君昊
2023-03-14

我想使用 ANT 脚本将自定义 CSS 样式表添加到我的 DITA 主题模型中(请参阅以下代码):

我的ANT脚本:

<?xml version="1.0" encoding="UTF-8" ?>
<!-- ==================
  Web Output Custom CSS 
  ==================-->
<project name="grid_web_css"default="grids.grid_web_css" basedir=".">

    <property name="dita.dir" location="${basedir}${file.separator}..${file.separator}..${file.separator}.."/>
    <property name="css.output.dir" value="${dita.dir}${file.separator}projects${file.separator}css-projects${file.separator}ant-scripts${file.separator}out${file.separator}ex-ant-understanding-css"/>
    <property name="the.input.dir" value="${dita.dir}${file.separator}projects${file.separator}css-projects"/>
    <property name="css.source.dir" location="${dita.dir}${file.separator}projects${file.separator}css-projects${file.separator}shared-assets"/>
    <target name="grids.grid_web_css" depends="clean.grids.grid_web_css">
        <ant antfile="${dita.dir}/build.xml">
            <property name="args.input" location="${dita.dir}${file.separator}projects${file.separator}css-projects${file.separator}understanding_css.ditamap"/>
            <property name="input.dir" location="${the.input.dir}"/>
            <property name="output.dir" location="${css.output.dir}"/>
            <property name="transtype" value="html5"/>
            <property name="args.cssroot" location="${css.source.dir}"/>
            <property name="args.css" value="${css.source.dir}${file.separator}web-css-grids.css"/>
            <property name="args.csspath" value="${css.output.dir}/css"/>
            <property name="args.copycss" value="yes"/>
            <property name="processor" value="saxon"/>
            <property name="classpath" value="${dita.dir}${file.separator}lib${file.separator}saxon.jar"/>
        </ant>
        <copy todir="${css.output.dir}/css">
            <fileset dir="${css.source.dir}"/>
        </copy>
    </target>
    <target name="clean.grids.grid_web_css" description="remove the sample web output">
        <delete dir="${css.output.dir}"/>
    </target>
</project>

根据下面的终端输出,创建了目录,找到并执行了build.xml文件。然而,目录中实际上没有生成任何东西,我无法隔离问题。

lingeringcode@Linger:~/dita-ot-2.1.1$ ant -f '/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/ant_grid_web_css.xml' 
Buildfile: /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/ant_grid_web_css.xml

clean.grids.grid_web_css:
   [delete] Deleting directory /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/out/ex-ant-understanding-css

grids.grid_web_css:

init:

dita2html5.init:

check-arg:
    [mkdir] Created dir: /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/out/ex-ant-understanding-css
    [mkdir] Created dir: /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/temp/temp20151020094428144

log-arg:
     [echo] *****************************************************************
     [echo] * basedir = /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts
     [echo] * dita.dir = /home/lingeringcode/dita-ot-2.1.1
     [echo] * transtype = html5
     [echo] * tempdir = /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/temp/temp20151020094428144
     [echo] * outputdir = /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/out/ex-ant-understanding-css
     [echo] * clean.temp = true
     [echo] * DITA-OT version = 2.1.1
     [echo] * XML parser = Xerces
     [echo] * XSLT processor = Saxon
     [echo] * collator = JDL
     [echo] *****************************************************************
     [echo] #Ant properties
     [echo] #Tue Oct 20 09:44:29 CDT 2015
     [echo] args.copycss=yes
     [echo] args.css=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/shared-assets/web-css-grids.css
     [echo] args.csspath=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/out/ex-ant-understanding-css/css
     [echo] args.cssroot=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/shared-assets
     [echo] args.grammar.cache=yes
     [echo] args.input=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/understanding_css.ditamap
     [echo] args.logdir=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/out/ex-ant-understanding-css
     [echo] args.xml.systemid.set=yes
     [echo] dita.dir=/home/lingeringcode/dita-ot-2.1.1
     [echo] dita.plugin.com.sophos.tocjs.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/com.sophos.tocjs
     [echo] dita.plugin.org.dita.base.dir=/home/lingeringcode/dita-ot-2.1.1
     [echo] dita.plugin.org.dita.docbook.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.docbook
     [echo] dita.plugin.org.dita.eclipsecontent.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.eclipsecontent
     [echo] dita.plugin.org.dita.eclipsehelp.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.eclipsehelp
     [echo] dita.plugin.org.dita.htmlhelp.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.htmlhelp
     [echo] dita.plugin.org.dita.javahelp.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.javahelp
     [echo] dita.plugin.org.dita.odt.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.odt
     [echo] dita.plugin.org.dita.pdf2.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.pdf2
     [echo] dita.plugin.org.dita.specialization.dita11.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.specialization.dita11
     [echo] dita.plugin.org.dita.specialization.eclipsemap.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.specialization.eclipsemap
     [echo] dita.plugin.org.dita.troff.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.troff
     [echo] dita.plugin.org.dita.wordrtf.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.wordrtf
     [echo] dita.plugin.org.dita.xhtml.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.xhtml
     [echo] dita.plugin.org.oasis-open.dita.v1_2.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.oasis-open.dita.v1_2
     [echo] dita.temp.dir=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/temp/temp20151020094428144
     [echo] *****************************************************************

build-init:

preprocess.init:
     [echo] *****************************************************************
     [echo] * input = /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/understanding_css.ditamap
     [echo] *****************************************************************

gen-list:

BUILD FAILED
/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/ant_grid_web_css.xml:18: The following error occurred while executing this line:
/home/lingeringcode/dita-ot-2.1.1/build.xml:42: The following error occurred while executing this line:
/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.base/build_preprocess.xml:78: java.lang.ClassNotFoundException: org.dita.dost.module.GenMapAndTopicListModule
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:191)
    at org.apache.tools.ant.IntrospectionHelper$6.set(IntrospectionHelper.java:1095)
    at org.apache.tools.ant.IntrospectionHelper$AttributeSetter.setObject(IntrospectionHelper.java:1493)
    at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:411)
    at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:528)
    at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:464)
    at org.apache.tools.ant.UnknownElement.handleChild(UnknownElement.java:592)
    at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:358)
    at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:204)
    at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
    at org.apache.tools.ant.Task.perform(Task.java:347)
    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:440)
    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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:440)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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)

从上面的输出可以看出,错误输出在“BUILD FAILED”行之后开始。

    < li >我发现其他人也有类似的问题:https://groups . Yahoo . com/neo/groups/dita-users/conversations/topics/38045。然而,当我添加属性并为Saxon设置环境变量时,我得到了相同的输出。 < li >我还在Open Toolkit中测试了其他ant脚本示例,并收到了相同的错误消息。

我想我要么设置环境变量不正确,要么有一些我甚至无法想象的事情导致了这个问题;因此,我需要一些额外的眼睛来关注这个问题。

因此,也许有人可以帮助我了解如何设置我的java ant saxon xalan-我还没有在这个过程中找到好的留档。另外,如何验证我拥有让它工作所需的一切。或者,我很乐意帮助看看它是否是别的东西。

仅供参考,我使用的是DITA-OT 2.1.1。这是我在Github上的主题模型的链接:https://github.com/lingeringcode/css-projects.

感谢您的帮助!:-)

FTR,< code>dita命令使用< code>-D参数,如下所示:

:~/dita-ot-2.1.1$ dita -f html5 -i 'projects/css-projects/understanding_css.ditamap' \
    -o 'projects/css-projects/ex-understanding-css' \
    -Dargs.cssroot='projects/css-projects/shared-assets' \
    -Dargs.css='${cssroot}/web-css-grids.css' \
    -Dargs.csspath='css' \
    -Dargs.copycss='yes'

我还重置了CLASSPATH变量,确保确实找到了dost.jar。再次运行ant脚本后,我收到了一条新的BUILD FAILED错误消息(耶,进度?!)如下所示:

    lingeringcode@Linger:~/dita-ot-2.1.1/projects/css-projects$ ant -f '/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/ant_grid_web_css.xml' 
Buildfile: /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/ant_grid_web_css.xml

clean.grids.grid_web_css:
   [delete] Deleting directory /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ex-ant-understanding-css

grids.grid_web_css:

init:

dita2html5.init:

check-arg:
    [mkdir] Created dir: /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ex-ant-understanding-css
    [mkdir] Created dir: /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/temp/temp20151022130204394

log-arg:
     [echo] *****************************************************************
     [echo] * basedir = /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts
     [echo] * dita.dir = /home/lingeringcode/dita-ot-2.1.1
     [echo] * transtype = html5
     [echo] * tempdir = /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/temp/temp20151022130204394
     [echo] * outputdir = /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ex-ant-understanding-css
     [echo] * clean.temp = true
     [echo] * DITA-OT version = 2.1.1
     [echo] * XML parser = Xerces
     [echo] * XSLT processor = Saxon
     [echo] * collator = JDL
     [echo] *****************************************************************
     [echo] #Ant properties
     [echo] #Thu Oct 22 13:02:05 CDT 2015
     [echo] args.copycss=yes
     [echo] args.css=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/shared-assets/web-css-grids.css
     [echo] args.csspath=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ex-ant-understanding-css/css
     [echo] args.cssroot=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/shared-assets
     [echo] args.grammar.cache=yes
     [echo] args.input=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/understanding_css.ditamap
     [echo] args.logdir=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ex-ant-understanding-css
     [echo] args.xml.systemid.set=yes
     [echo] dita.dir=/home/lingeringcode/dita-ot-2.1.1
     [echo] dita.plugin.com.sophos.tocjs.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/com.sophos.tocjs
     [echo] dita.plugin.org.dita.base.dir=/home/lingeringcode/dita-ot-2.1.1
     [echo] dita.plugin.org.dita.docbook.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.docbook
     [echo] dita.plugin.org.dita.eclipsecontent.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.eclipsecontent
     [echo] dita.plugin.org.dita.eclipsehelp.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.eclipsehelp
     [echo] dita.plugin.org.dita.htmlhelp.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.htmlhelp
     [echo] dita.plugin.org.dita.javahelp.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.javahelp
     [echo] dita.plugin.org.dita.odt.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.odt
     [echo] dita.plugin.org.dita.pdf2.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.pdf2
     [echo] dita.plugin.org.dita.specialization.dita11.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.specialization.dita11
     [echo] dita.plugin.org.dita.specialization.eclipsemap.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.specialization.eclipsemap
     [echo] dita.plugin.org.dita.troff.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.troff
     [echo] dita.plugin.org.dita.wordrtf.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.wordrtf
     [echo] dita.plugin.org.dita.xhtml.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.xhtml
     [echo] dita.plugin.org.oasis-open.dita.v1_2.dir=/home/lingeringcode/dita-ot-2.1.1/plugins/org.oasis-open.dita.v1_2
     [echo] dita.temp.dir=/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/temp/temp20151022130204394
     [echo] *****************************************************************

build-init:

preprocess.init:
     [echo] *****************************************************************
     [echo] * input = /home/lingeringcode/dita-ot-2.1.1/projects/css-projects/understanding_css.ditamap
     [echo] *****************************************************************

gen-list:
 [gen-list] Failed to read print transtypes from configuration, using defaults.
 [gen-list] Using Xerces grammar pool for DTD and schema caching.
 [gen-list] Processing file:/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/understanding_css.ditamap

BUILD FAILED
/home/lingeringcode/dita-ot-2.1.1/projects/css-projects/ant-scripts/ant_grid_web_css.xml:24: The following error occurred while executing this line:
/home/lingeringcode/dita-ot-2.1.1/build.xml:42: The following error occurred while executing this line:
/home/lingeringcode/dita-ot-2.1.1/plugins/org.dita.base/build_preprocess.xml:78: Failed to run pipeline: Failed to load messages configuration file: Message configuration file not found

现在,它报告“失败的管道”无法加载某些配置文件。有什么想法吗?

共有1个答案

邹玮
2023-03-14

这是重要信息:

java.lang.ClassNotFoundException: org.dita.dost.module.GenMapAndTopicListModule

这表明dost.jar丢失。您必须将DITA库传递给蚂蚁,否则脚本无法工作。

您可以在使用Ant的文档Building输出中阅读如何调用Ant。

也许你根本不需要用蚂蚁调用你的转换。dita命令有一个args.css参数,它可能会做你试图实现的事情。请看看蚂蚁参数:常见的基于超文本标记语言的转换。

 类似资料:
  • 我在Heroku的./bin文件夹中有这个脚本。该脚本调用parse cloud函数。 脚本运行时没有错误 Heroku控制台日志显示如下输出。云函数有一些console.log语句,但是它们的输出也没有出现。 heroku[router]:at=info-method=POST-path=“/parse/functions/resetJob”host=app.herokuapp。com requ

  • null 现在我只想在我的目录中测试命令: 我得到了这个: 失败:生成失败,出现异常。*错误:Java.lang.unsupportedClassVersionError:org/javamodularity/modulePlugin/moduleSystemPlugin是由最新版本的Java运行时(类文件版本55.0)编译的,此版本的Java运行时只识别类文件版本高达52.0 我使用SDKMAN

  • 可以从jar文件中运行ant脚本吗? 目前,我有一个build.xml,它调用一些java代码,这些代码在一个jar文件中。然后它做一些进一步的蚂蚁处理。 当我从Eclipse导出jar文件时,我可以选择添加构建。xml文件到jar,所以我想知道我是否可以直接从jar运行ant脚本,这样我只需要给人们jar文件,而不是ant脚本。

  • 我有一个 PS 脚本,用于在 Office 365 中创建新用户。我正在使用微软在线和 AzureAD 模块来执行我需要的一切。 我需要从我的Python脚本运行PS脚本,但它不工作,我得到了“未识别的cmdlet”错误。 PS脚本非常基本,它在连接到Msol服务时失败,并继续运行,就像一切正常一样。 我尝试为MSOnline和AzureAD添加导入模块,但没有成功。值得一提的是,该脚本本身确实有

  • 当我试图使用执行PHP脚本时,它不起作用。 在错误日志文件中显示: PHP警告:shell_exec()[function.shell exec]:无法执行'PHP/home/snabsam/public_html/。。。。。 系统 Centos shell_exec与clamscan配合使用 与clamav的功能配合使用 但它没有执行PHP脚本 我检查过的东西: PHP是off 不存在于在php