1
votes

DITA Output Goal

I want to add a custom CSS stylesheet to my DITA topic model with an ANT script (see the following code):

ANT Script Code

My ANT script:

<?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>

Problem

The directory is made and the build.xml file is found and executed, as per the terminal output below. Yet, nothing is actually generated within the directory, and I can't isolate the problem.

Terminal Output

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)

As you can read from the output above, the error output begins after the "BUILD FAILED" line.

My troubleshooting attempts

Call for help

I think I either set up my environment variables incorrectly, or there's something I can't even imagine causing this issue; hence, I need some extra eyes on this issue.

Accordingly, maybe someone could help walk me through how I am supposed to set up my java + ant + saxon + xalan—I have yet to find good documentation on this process. Plus, how to verify I have everything I need to get this to work. Or, I would love help to see if it's something else.

FYI, I'm using DITA-OT 2.1.1. Here's a link to my topic model on Github: https://github.com/lingeringcode/css-projects.

Any help is appreciated! :-)

UPDATE

FTR, the dita command works with the -D args, as follows:

:~/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'

I also reset my CLASSPATH variables, making sure the dost.jar was indeed found. After running the ant script again, I received a new BUILD FAILED error message (yay, progress?!) as seen below:

    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

Now, it's reporting the "failed pipeline" + failure to load some config file. Any ideas?

1
Do you still need help with this? Please, if you get another error, do not update your original question but create a new one. Otherwise nobody is notified.Stefan Eike
Hi, @xephon, thanks for checking back with me. I haven't had time to go back to this particular method. Instead, I used the command-line arguments. If I do return to this method, I will definitely take this into consideration. Thank you!Chris Lindgren

1 Answers

1
votes

This is the important information:

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

This indicates that the dost.jar is missing. You have to pass the DITA libraries to Ant, otherwise the script does not work.

You can read in the docs Building output using Ant how you should call Ant.

Maybe you do not need to call your transformation with Ant at all. The dita command has an args.css parameter that probably does what you are trying to achieve. Please have a look at Ant parameters: Common HTML-based transformations.