title: Ant running from maven-antrun-plugin can't find scripting engine on Java 9
body: <p>I have a Maven project using an Ant build file:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;project&gt;
     &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
     &lt;artifactId&gt;my-test-app&lt;/artifactId&gt;
     &lt;groupId&gt;my-test-group&lt;/groupId&gt;
     &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
     &lt;build&gt;
        &lt;plugins&gt;
           &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.8&lt;/version&gt;
              &lt;executions&gt;
                 &lt;execution&gt;
                    &lt;id&gt;compile&lt;/id&gt;
                    &lt;phase&gt;compile&lt;/phase&gt;
                    &lt;configuration&gt;
                       &lt;target&gt;
                          &lt;ant antfile="build.xml" inheritRefs="true"&gt;
                             &lt;target name="all"/&gt;
                          &lt;/ant&gt;
                       &lt;/target&gt;
                    &lt;/configuration&gt;
                    &lt;goals&gt;
                       &lt;goal&gt;run&lt;/goal&gt;
                    &lt;/goals&gt;
                 &lt;/execution&gt;
              &lt;/executions&gt;
           &lt;/plugin&gt;
        &lt;/plugins&gt;
     &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>The Ant build file uses a script:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;project name="scriptdef-test-build"&gt;
     &lt;scriptdef name="test-script" language="javascript"&gt;
        &lt;![CDATA[
             var System = Java.type('java.lang.System');
             System.out.println("Working!");
          ]]&gt;
     &lt;/scriptdef&gt;
     &lt;target name="all"&gt;
        &lt;test-script/&gt;
     &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>On Java 8 it works, but on Java 9 (9-ea+162) it can't find the script engine:</p>
  
  <pre><code>org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (compile) on project my-test-app: An Ant BuildException has occured: The following error occurred while executing this line:
  /home/dan/scriptdef-test/build.xml:10: Unable to create javax script engine for javascript
  around Ant part ...&lt;ant antfile="build.xml" inheritRefs="true"&gt;... @ 4:47 in /home/dan/scriptdef-test/target/antrun/build-main.xml
  ...    
  Caused by: /home/dan/scriptdef-test/build.xml:10: Unable to create javax script engine for javascript
      at org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:84)
      at org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:67)
      at org.apache.tools.ant.taskdefs.optional.script.ScriptDef.executeScript(ScriptDef.java:350)
      at org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase.execute(ScriptDefBase.java:50)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:547)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.Target.execute(Target.java:435)
      at org.apache.tools.ant.Target.performTasks(Target.java:456)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
      at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
      at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
      ... 34 more
  </code></pre>
  
  <p>I have attached a debugger and I saw that the <code>ScriptEngineManager</code> used by <code>JavaxScriptRunner</code> doesn't have any script engines, because the service loader it uses doesn't find any <code>ScriptEngineFactory</code> implementations. How can I get the service loader to work?</p>
  
  <p>Update: I've also created an issue for this: <a href="https://issues.apache.org/jira/browse/MANTRUN-200" rel="noreferrer">https://issues.apache.org/jira/browse/MANTRUN-200</a></p>