Oracle has depreciated nashorn and I use it in my apache ant build scripts.
Here is a short example;
try{load("nashorn:mozilla_compat.js");}catch(e){;}
importClass(java.io.File);
var sourceName = project.getProperty("build.source.dir") + "/" +project.getProperty("teiFile") + ".xml";
var targetName = project.getProperty("build.search.dir") + "/" + project.getProperty("teiFile") + ".xml";
var sourceFile = new File("", sourceName);
var targetFile = new File("", targetName);
var uptodate = targetFile.exists() && sourceFile.lastModified() < targetFile.lastModified();
var sourcePrefix = project.getProperty("teiFile");
if(!uptodate & !sourcePrefix.startsWith("G")) {
......
}
}
I've heard mentions of Rhino or graalVM as a replacement, but each seems to have a fairly long list of deficiencies.Suggestions for a library that is currently active and stable.
thanks, scott
GraalVM is currently active, stable, has a Nashorn compatibility mode. You can run your ant scripts with GraalVM, and the JS engine is included by default. Or you can include GraalVM's JavaScript as a few dependencies and run on OpenJDK, which will be slower, and might be an untested combination of OpenJDK and GraalVM's JavaScript, but can also work.