https://bz.apache.org/bugzilla/show_bug.cgi?id=64469

            Bug ID: 64469
           Summary: Ant build.xml fails with "Unable to create javax
                    script engine for javascript" with latest JDK 15 due
                    to removal of Nashorn
           Product: Ant
           Version: 1.10.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: dominik.stad...@gmx.at
  Target Milestone: ---

The Javascript engine was deprecated in JDK 11 and now removed JKD 15, see
https://openjdk.java.net/jeps/372 for details. 

Ant uses it for providing the <scriptdef> and <script> task.

Apache POI uses Apache Ant for building. When testing the build with the latest
JDK 15 pre-release 15-ea+24-1168, the build fails because it uses the
<scriptdef> task, but the Javascript implementation "Nashorn" was removed from
the JDK now.

Output is:

    build.xml:122: Unable to create javax script engine for javascript

I tried to use the supported engine "bsf", but I could not find documentation
about how to actually make it work and some simple tries resulted in "Unable to
load the BSF script engine manager (org.apache.bsf.BSFManager)" when using 3.x,
with 2.4.0 it worked a bit more, but also failed, because simple things like
String.replace(Regex, String) are not supported.

See https://golb.hplar.ch/2020/04/java-javascript-engine.html for a possible
replacement via graal-js. However when trying to use this implementation in
Ant, I get an error "Unsupported language prefix graal.js", so Ant seems to
currently hardcode the list of implementations, see
https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/util/ScriptRunnerCreator.java

So it seems for full support of JDK 15, Ant will need to allow to switch to
another Javascript implementation, e.g. graal-js as the only current option
"bsf" is not a good replacement upon a quick look.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to