https://bz.apache.org/bugzilla/show_bug.cgi?id=68542
Bug ID: 68542
Summary: How to run external javascript with Java 17 using ant
Product: Ant
Version: 1.10.14
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Core
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Could you please explain, how to use
<script language="javascript" ...
with Java 17.
Under the https://ant.apache.org/manual/Tasks/script.html there's only
information about using external dependencies.
Found one useful link -
https://stackoverflow.com/questions/69832933/apache-ant-with-graal-vm
Seems like adding libs to %ANT%/lib helps but it's not the solution in our case
as we need to run ant with both Java 8 and 17.
Adding
<path id="javax.classpath">
<pathelement location="./nashorn-core-15.4.jar"/>
<pathelement location="./asm-9.6.jar"/>
<pathelement location="./asm-util-9.6.jar"/>
</path>
or
<path id="javax.classpath">
<pathelement location="./graal-sdk-22.3.1.jar"/>
<pathelement location="./icu4j-72.1.jar"/>
<pathelement location="./js-22.3.1.jar"/>
<pathelement location="./js-launcher-22.3.1.jar"/>
<pathelement location="./regex-22.3.1.jar"/>
<pathelement location="./truffle-api-22.3.1.jar"/>
</path>
and running
<script language="javascript" manager="javax"
classpathref="javax.classpath">
...
Still generates
Java 15 has removed Nashorn, you must provide an engine for running JavaScript
yourself. GraalVM JavaScript currently is the preferred option.
BUILD FAILED
The following error occurred while executing this line:
Unable to create javax script engine for javascript
--
You are receiving this mail because:
You are the assignee for the bug.