Ant running from maven-antrun-plugin can't find scripting engine on Java 9 -
i have maven project using ant build file:
<?xml version='1.0' encoding='utf-8'?> <project> <modelversion>4.0.0</modelversion> <artifactid>my-test-app</artifactid> <groupid>my-test-group</groupid> <version>1.0-snapshot</version> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-antrun-plugin</artifactid> <version>1.8</version> <executions> <execution> <id>compile</id> <phase>compile</phase> <configuration> <target> <ant antfile="build.xml" inheritrefs="true"> <target name="all"/> </ant> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
the ant build file uses script:
<?xml version='1.0' encoding='utf-8'?> <project name="scriptdef-test-build"> <scriptdef name="test-script" language="javascript"> <![cdata[ var system = java.type('java.lang.system'); system.out.println("working!"); ]]> </scriptdef> <target name="all"> <test-script/> </target> </project>
on java 8 works, on java 9 (9-ea+162) can't find script engine:
org.apache.maven.lifecycle.lifecycleexecutionexception: failed execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (compile) on project my-test-app: ant buildexception has occured: following error occurred while executing line: /home/dan/scriptdef-test/build.xml:10: unable create javax script engine javascript around ant part ...<ant antfile="build.xml" inheritrefs="true">... @ 4:47 in /home/dan/scriptdef-test/target/antrun/build-main.xml ... caused by: /home/dan/scriptdef-test/build.xml:10: unable create javax script engine javascript @ org.apache.tools.ant.util.optional.javaxscriptrunner.evaluatescript(javaxscriptrunner.java:84) @ org.apache.tools.ant.util.optional.javaxscriptrunner.executescript(javaxscriptrunner.java:67) @ org.apache.tools.ant.taskdefs.optional.script.scriptdef.executescript(scriptdef.java:350) @ org.apache.tools.ant.taskdefs.optional.script.scriptdefbase.execute(scriptdefbase.java:50) @ org.apache.tools.ant.unknownelement.execute(unknownelement.java:292) @ java.base/jdk.internal.reflect.nativemethodaccessorimpl.invoke0(native method) @ java.base/jdk.internal.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ java.base/jdk.internal.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.base/java.lang.reflect.method.invoke(method.java:547) @ org.apache.tools.ant.dispatch.dispatchutils.execute(dispatchutils.java:106) @ org.apache.tools.ant.task.perform(task.java:348) @ org.apache.tools.ant.target.execute(target.java:435) @ org.apache.tools.ant.target.performtasks(target.java:456) @ org.apache.tools.ant.project.executesortedtargets(project.java:1393) @ org.apache.tools.ant.helper.singlecheckexecutor.executetargets(singlecheckexecutor.java:38) @ org.apache.tools.ant.project.executetargets(project.java:1248) @ org.apache.tools.ant.taskdefs.ant.execute(ant.java:441) ... 34 more
i have attached debugger , saw scriptenginemanager
used javaxscriptrunner
doesn't have script engines, because service loader uses doesn't find scriptenginefactory
implementations. how can service loader work?
update: i've created issue this: https://issues.apache.org/jira/browse/mantrun-200
Comments
Post a Comment