DITA-OT Custom jars
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 91
- Joined: Tue Jul 17, 2018 6:57 am
DITA-OT Custom jars
Post by msambasiva »
Hi,
DITA-OT 2.4.6
We have developed a DITA-OT plugin which is using custom jar. The custom jar itself using some other third party jars. So to make it work, I am copying the custom jar & dependent jars into <DITA-OT>/lib.
How best we can avoid manually copy the custom jar & dependent jars into <DITA-OT>/lib.
How to maintain the custom jars of lib folder with DITA-OT version changes? i.e if we migrate or reinstall DITA-OT, how best we can get the custom jars.
I am not sure if I am correct, here is what I am thinking, maintain the custom/dependent jar at repository and checkout. Finally add the custom path to CLASSPATH variable.
Thanks,
Samba.
DITA-OT 2.4.6
We have developed a DITA-OT plugin which is using custom jar. The custom jar itself using some other third party jars. So to make it work, I am copying the custom jar & dependent jars into <DITA-OT>/lib.
How best we can avoid manually copy the custom jar & dependent jars into <DITA-OT>/lib.
How to maintain the custom jars of lib folder with DITA-OT version changes? i.e if we migrate or reinstall DITA-OT, how best we can get the custom jars.
I am not sure if I am correct, here is what I am thinking, maintain the custom/dependent jar at repository and checkout. Finally add the custom path to CLASSPATH variable.
Thanks,
Samba.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: DITA-OT Custom jars
Hi Samba,
You can contribute the JAR library directly from your DITA OT plugin's plugin.xml:
https://www.dita-ot.org/dev/topics/plugin-javalib.html
You can contribute the JAR library directly from your DITA OT plugin's plugin.xml:
https://www.dita-ot.org/dev/topics/plugin-javalib.html
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 91
- Joined: Tue Jul 17, 2018 6:57 am
Re: DITA-OT Custom jars
Post by msambasiva »
Thanks Radu!
There are some dependent jars like log4j-api-2.13.2.jar, log4j-core-2.13.2.jar,commons-codec-1.10.jar etc which are not part of default DITA-OT installation. Can we use the same extension dita.conductor.lib.import for number of times to include all the dependent jar? Could you suggest best way to manage the jars and dependent jars on re/installation of DITA OT?
There are some dependent jars like log4j-api-2.13.2.jar, log4j-core-2.13.2.jar,commons-codec-1.10.jar etc which are not part of default DITA-OT installation. Can we use the same extension dita.conductor.lib.import for number of times to include all the dependent jar? Could you suggest best way to manage the jars and dependent jars on re/installation of DITA OT?
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: DITA-OT Custom jars
Hi,
In the plugin.xml you can add references to multiple jar libraries, like for example:
https://github.com/jelovirt/org.lwdita/ ... plugin.xml
This is the portable way of doing things as the plugin will include everything inside.
Regards,
Radu
In the plugin.xml you can add references to multiple jar libraries, like for example:
https://github.com/jelovirt/org.lwdita/ ... plugin.xml
This is the portable way of doing things as the plugin will include everything inside.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 91
- Joined: Tue Jul 17, 2018 6:57 am
Re: DITA-OT Custom jars
Post by msambasiva »
Hi,
We have created a separate plugin uae.dita.resources to have resources like libraries and xml. Below is the feature element having reference to resources plugin.
<feature extension="dita.conductor.lib.import" file="${dita.plugin.uae.dita.resources.dir}/resources/lib/log4j-api-2.13.2.jar"/>
Some how, getting exception in the plugin installation process as below,
DITA> /scratch/uae/src/dita-ot-2.4.6/resources/env.sh: line 27: $CLASSPATH:$DITA_HOME/plugins/uae.dita.analytics/${dita.plugin.uae.dita.resources.dir}/resources/lib/log4j-api-2.13.2.jar: bad substitution
DITA> /scratch/uae/src/dita-ot-2.4.6/resources/env.sh: line 28: $CLASSPATH:$DITA_HOME/plugins/uae.dita.analytics/${dita.plugin.uae.dita.resources.dir}/resources/lib/log4j-core-2.13.2.jar: bad substitution
Please correct me if Iam wrong at referencing resources of other plugin in my plugin.xml
Thanks,
Samba.
We have created a separate plugin uae.dita.resources to have resources like libraries and xml. Below is the feature element having reference to resources plugin.
<feature extension="dita.conductor.lib.import" file="${dita.plugin.uae.dita.resources.dir}/resources/lib/log4j-api-2.13.2.jar"/>
Some how, getting exception in the plugin installation process as below,
DITA> /scratch/uae/src/dita-ot-2.4.6/resources/env.sh: line 27: $CLASSPATH:$DITA_HOME/plugins/uae.dita.analytics/${dita.plugin.uae.dita.resources.dir}/resources/lib/log4j-api-2.13.2.jar: bad substitution
DITA> /scratch/uae/src/dita-ot-2.4.6/resources/env.sh: line 28: $CLASSPATH:$DITA_HOME/plugins/uae.dita.analytics/${dita.plugin.uae.dita.resources.dir}/resources/lib/log4j-core-2.13.2.jar: bad substitution
Please correct me if Iam wrong at referencing resources of other plugin in my plugin.xml
Thanks,
Samba.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: DITA-OT Custom jars
Hi Samba,
Editor variables like "${dita.plugin.uae.dita.resources.dir}/" are not expanded in library paths when the JAR libraries are gathered by the DITA OT engine.
The references to the JAR libraries should be relative to the plugin.xml where they are defined, in your case, they should probably be:
Regards,
Radu
Editor variables like "${dita.plugin.uae.dita.resources.dir}/" are not expanded in library paths when the JAR libraries are gathered by the DITA OT engine.
The references to the JAR libraries should be relative to the plugin.xml where they are defined, in your case, they should probably be:
Code: Select all
<feature extension="dita.conductor.lib.import" file="resources/lib/log4j-api-2.13.2.jar"/>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 91
- Joined: Tue Jul 17, 2018 6:57 am
Re: DITA-OT Custom jars
Post by msambasiva »
Hi,
I got struck with importing jars present in <our-plugin>/lib folder.
Below is the url of having similar problem
https://stackoverflow.com/questions/588 ... -classpath
I finally nailed what was wrong with my DITA OT configuration.
I was using an ant build script to run DITA OT and when doing this, the plugin JARs are not automatically added to the classpath.
I switched to using the DITA OT command line. Now my JARs are seen by the ant scripts and my extension functions are accessible from the XSLT.
In addition, if someone else has a classpath problem like this, you can also check the file [DITA-OT]/config/env.bat (env.sh for lunix users). After installing a plugin that provides its own JAR libraries, the JAR files shall be present in this file:
set "CLASSPATH=%CLASSPATH%;%DITA_HOME%\plugins\org.dita.pdf2\lib\fo.jar"
set "CLASSPATH=%CLASSPATH%;%DITA_HOME%\plugins\com.infotel.orlando.pdf\.\xslt-extension.jar"
set "CLASSPATH=%CLASSPATH%;%DITA_HOME%\plugins\org.dita.eclipsehelp\lib\eclipsehelp.jar"
...
As of now, we are using below ant command to run the plugin to convert xmls of a folder to dita files,
bin\ant -Dtranstype=analyticsdita -Dargs.input.dir="analytics\input\deck_cards" -Doutput.dir="analytics\out"
Some how I don't find option to pass folder as an argument to dita command.. Could you suggest dita command similar to above ant cmd?
Thanks,
Samba.
I got struck with importing jars present in <our-plugin>/lib folder.
Below is the url of having similar problem
https://stackoverflow.com/questions/588 ... -classpath
I finally nailed what was wrong with my DITA OT configuration.
I was using an ant build script to run DITA OT and when doing this, the plugin JARs are not automatically added to the classpath.
I switched to using the DITA OT command line. Now my JARs are seen by the ant scripts and my extension functions are accessible from the XSLT.
In addition, if someone else has a classpath problem like this, you can also check the file [DITA-OT]/config/env.bat (env.sh for lunix users). After installing a plugin that provides its own JAR libraries, the JAR files shall be present in this file:
set "CLASSPATH=%CLASSPATH%;%DITA_HOME%\plugins\org.dita.pdf2\lib\fo.jar"
set "CLASSPATH=%CLASSPATH%;%DITA_HOME%\plugins\com.infotel.orlando.pdf\.\xslt-extension.jar"
set "CLASSPATH=%CLASSPATH%;%DITA_HOME%\plugins\org.dita.eclipsehelp\lib\eclipsehelp.jar"
...
As of now, we are using below ant command to run the plugin to convert xmls of a folder to dita files,
bin\ant -Dtranstype=analyticsdita -Dargs.input.dir="analytics\input\deck_cards" -Doutput.dir="analytics\out"
Some how I don't find option to pass folder as an argument to dita command.. Could you suggest dita command similar to above ant cmd?
Thanks,
Samba.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: DITA-OT Custom jars
Hi Samba,
Right, you should always use the "dita" command to perform the processing in order to properly load all JAR libraries.
The "dita" command only takes a single DITA Map or topic as argument but you could try to call it multiple times, once for each file. You can also call the "dita" command from an ANT build file:
https://www.dita-ot.org/dev/topics/migr ... -dita.html
Regards,
Radu
Right, you should always use the "dita" command to perform the processing in order to properly load all JAR libraries.
The "dita" command only takes a single DITA Map or topic as argument but you could try to call it multiple times, once for each file. You can also call the "dita" command from an ANT build file:
https://www.dita-ot.org/dev/topics/migr ... -dita.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 91
- Joined: Tue Jul 17, 2018 6:57 am
Re: DITA-OT Custom jars
Post by msambasiva »
Thanks Radu!
We found that, even ANT command also able to load the jars placed within the plugin (instead of DITA-OT\lib) by setting refid="dost.class.path" of classpath element as below.
<java classname="com.mycompany.exceltoxml.EntryPoint">
<classpath refid="dost.class.path"/>
<arg value="${inputMap}${file.separator}"/>
<arg value="${xmlOutputDir}${file.separator}"/>
</java>
Regards,
Samba.
We found that, even ANT command also able to load the jars placed within the plugin (instead of DITA-OT\lib) by setting refid="dost.class.path" of classpath element as below.
<java classname="com.mycompany.exceltoxml.EntryPoint">
<classpath refid="dost.class.path"/>
<arg value="${inputMap}${file.separator}"/>
<arg value="${xmlOutputDir}${file.separator}"/>
</java>
Regards,
Samba.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: DITA-OT Custom jars
HI Samba,
Yes, right, the "dost.class.path" should have references to all Jars and you can set it as a classpath to an ANT "java" task.
Regards,
Radu
Yes, right, the "dost.class.path" should have references to all Jars and you can set it as a classpath to an ANT "java" task.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service