I’m migrating our custom plugins to DITA OT 4.2.3, which requires a newer version of the JDK. We’re using Amazon Corretto 21.0.3.9.1. We have one Ant build script that contains JavaScript. Since the JDK no longer contains the JavaScript engine, we’re using Nashorn 15.4.
I copied the latest versions of the files (nashorn-core-15.4.jar, asm-9.7.jar, and asm-util-9.7.jar) into the lib folder of the plugin. In the Ant script, I added the following lines between <project> and the first <target>.
<path id="javax.classpath">
<pathelement location="./lib/nashorn-core-15.4.jar"/>
<pathelement location="./lib/asm-9.7.jar"/>
<pathelement location="./lib/asm-util-9.7.jar"/>
</path>
I changed the <script> element as follows:
<script language="javascript" manager="javax" classpathref="javax.classpath">
<![CDATA[var inputFolderInitVar = project.getProperty("inputFolderInit");
var lastBackSlash = inputFolderInitVar.lastIndexOf("\");
project.setProperty("inputFolder", inputFolderInit.substring(0, lastBackSlash));]]>
</script>
But I’m still getting the “Unable to create javax script engine for javascript” error. Any idea what I’m missing?
FYI, I’m looking at regular expressions with ant-contrib or using Groovy script if the JavaScript option doesn’t work. I would first like to see if we can get this working with JavaScript. Thanks.