[jira] [Comment Edited] (MANTRUN-200) Scriptdef tasks fail to load when running on Java9

2017-10-17 Thread Cristian Gheorghe Florescu (JIRA)

[ 
https://issues.apache.org/jira/browse/MANTRUN-200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16207112#comment-16207112
 ] 

Cristian Gheorghe Florescu edited comment on MANTRUN-200 at 10/17/17 7:22 AM:
--

Please try .

classpathref="maven.plugin.classpath" works for me.


was (Author: myset):
Please try 

> Scriptdef tasks fail to load when running on Java9
> --
>
> Key: MANTRUN-200
> URL: https://issues.apache.org/jira/browse/MANTRUN-200
> Project: Maven Antrun Plugin
>  Issue Type: Bug
>Affects Versions: 1.8
>Reporter: Dan Berindei
>Assignee: Robert Scholte
>
> I have a Maven project using maven-antrun-plugin:
> {code}
> 
> 
>4.0.0
>my-test-app
>my-test-group
>1.0-SNAPSHOT
>
>   
>  
> org.apache.maven.plugins
> maven-antrun-plugin
> 1.8
> 
>
>   compile
>   compile
>   
>  
> 
>
> 
>  
>   
>   
>  run
>   
>
> 
>  
>   
>
> 
> {code}
> The Ant build file uses a script:
> {code}
> 
> 
>
>   
>
>
>   
>
> 
> {code}
> On Java 8 it works, but on Java 9 (9-ea+162) it can't find the script engine:
> {noformat}
> 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 .. @ 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
> {noformat}
> I have attached a debugger and I saw that the {{ScriptEngineManager}} used by 
> {{JavaxScriptRunner}} doesn't have any script engines, because the service 
> loader it uses doesn't find any {{ScriptEngineFactory}} implementations. I 
> have tried {{\--add-modules jdk.scripting.nashorn}} and {{\--add-opens 
> jdk.scripting.nashorn/jdk.nashorn.api.scripting=ALL-UNNAMED}}, but neither 
> helped.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Comment Edited] (MANTRUN-200) Scriptdef tasks fail to load when running on Java9

2017-06-22 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MANTRUN-200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059904#comment-16059904
 ] 

Guillaume Boué edited comment on MANTRUN-200 at 6/22/17 9:06 PM:
-

This can be reproduced for any plugin, not just the Antrun Plugin, so this may 
be a Maven core concern. In any Mojo, doing

{code:java}
ServiceLoader.load(ScriptEngineFactory.class, classLoader).iterator().hasNext();
{code}

returns {{false}} when the {{classLoader}} used is the plugin class loader, 
obtained with {{getClass().getClassLoader()}}. It is the same result of 
{{false}} when using thread class loader.

However, when using the system class loader with 
{{ClassLoader.getSystemClassLoader()}}, this call correctly returns {{true}}, 
which is strange because the plugin class loader should have the system class 
loader as parent.


was (Author: gboue):
This can be reproduced for any plugin, not just the Antrun Plugin, so this may 
be a Maven core concern. In any Mojo, doing

{code:java}
ServiceLoader.load(ScriptEngineFactory.class, classLoader).iterator().hasNext();
{code}

returns {{false}} when the {{classLoader}} used is the plugin class loader, 
obtained with {{getClass().getClassLoader()}}. It is the same result of 
{{false}} when using thread class loader.
However, when using the system class loader with 
{{ClassLoader.getSystemClassLoader()}}, this call correctly returns {{true}}.

> Scriptdef tasks fail to load when running on Java9
> --
>
> Key: MANTRUN-200
> URL: https://issues.apache.org/jira/browse/MANTRUN-200
> Project: Maven Antrun Plugin
>  Issue Type: Bug
>Affects Versions: 1.8
>Reporter: Dan Berindei
>
> I have a Maven project using maven-antrun-plugin:
> {code}
> 
> 
>4.0.0
>my-test-app
>my-test-group
>1.0-SNAPSHOT
>
>   
>  
> org.apache.maven.plugins
> maven-antrun-plugin
> 1.8
> 
>
>   compile
>   compile
>   
>  
> 
>
> 
>  
>   
>   
>  run
>   
>
> 
>  
>   
>
> 
> {code}
> The Ant build file uses a script:
> {code}
> 
> 
>
>   
>
>
>   
>
> 
> {code}
> On Java 8 it works, but on Java 9 (9-ea+162) it can't find the script engine:
> {noformat}
> 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 .. @ 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
> {noformat}
> I have attached a debugger and I saw that the {{ScriptEngineManager}} used by 
> {{JavaxScriptRunner}} doesn't have any script engines, because the service 
> loader it uses doesn't find any {

[jira] [Comment Edited] (MANTRUN-200) Scriptdef tasks fail to load when running on Java9

2017-06-22 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MANTRUN-200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059904#comment-16059904
 ] 

Guillaume Boué edited comment on MANTRUN-200 at 6/22/17 9:01 PM:
-

This can be reproduced for any plugin, not just the Antrun Plugin, so this may 
be a Maven core concern. In any Mojo, doing

{code:java}
ServiceLoader.load(ScriptEngineFactory.class, classLoader).iterator().hasNext();
{code}

returns {{false}} when the {{classLoader}} used is the plugin class loader, 
obtained with {{getClass().getClassLoader()}}. It is the same result of 
{{false}} when using thread class loader.
However, when using the system class loader with 
{{ClassLoader.getSystemClassLoader()}}, this call correctly returns {{true}}.


was (Author: gboue):
This can be reproduced for any plugin, not just the Antrun Plugin, so this may 
be a Maven core concern. In any Mojo, doing

{code:java}
ServiceLoader.load(ScriptEngineFactory.class, classLoader).iterator().hasNext();
{code}

returns {{false}} when the {{classLoader}} used is the plugin class loader, 
obtained with {{getClass().getClassLoader()}}.
However, when using the system class loader with 
{{ClassLoader.getSystemClassLoader()}}, this call correctly returns {{true}}.

> Scriptdef tasks fail to load when running on Java9
> --
>
> Key: MANTRUN-200
> URL: https://issues.apache.org/jira/browse/MANTRUN-200
> Project: Maven Antrun Plugin
>  Issue Type: Bug
>Affects Versions: 1.8
>Reporter: Dan Berindei
>
> I have a Maven project using maven-antrun-plugin:
> {code}
> 
> 
>4.0.0
>my-test-app
>my-test-group
>1.0-SNAPSHOT
>
>   
>  
> org.apache.maven.plugins
> maven-antrun-plugin
> 1.8
> 
>
>   compile
>   compile
>   
>  
> 
>
> 
>  
>   
>   
>  run
>   
>
> 
>  
>   
>
> 
> {code}
> The Ant build file uses a script:
> {code}
> 
> 
>
>   
>
>
>   
>
> 
> {code}
> On Java 8 it works, but on Java 9 (9-ea+162) it can't find the script engine:
> {noformat}
> 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 .. @ 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
> {noformat}
> I have attached a debugger and I saw that the {{ScriptEngineManager}} used by 
> {{JavaxScriptRunner}} doesn't have any script engines, because the service 
> loader it uses doesn't find any {{ScriptEngineFactory}} implementations. I 
> have tried {{\--add-modules jdk.scripting.nashorn}} and {{\--add-opens 
> jdk.scripting.nashorn/jdk.nashorn.api.scripting=

[jira] [Comment Edited] (MANTRUN-200) Scriptdef tasks fail to load when running on Java9

2017-06-22 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MANTRUN-200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059904#comment-16059904
 ] 

Guillaume Boué edited comment on MANTRUN-200 at 6/22/17 8:46 PM:
-

This can be reproduced for any plugin, not just the Antrun Plugin, so this may 
be a Maven core concern. In any Mojo, doing

{code:java}
ServiceLoader.load(ScriptEngineFactory.class, classLoader).iterator().hasNext();
{code}

returns {{false}} when the {{classLoader}} used is the plugin class loader, 
obtained with {{getClass().getClassLoader()}}.
However, when using the system class loader with 
{{ClassLoader.getSystemClassLoader()}}, this call correctly returns {{true}}.


was (Author: gboue):
This can be reproduced for any plugin, not just the Antrun Plugin, so this may 
be a Maven core concern.

> Scriptdef tasks fail to load when running on Java9
> --
>
> Key: MANTRUN-200
> URL: https://issues.apache.org/jira/browse/MANTRUN-200
> Project: Maven Antrun Plugin
>  Issue Type: Bug
>Affects Versions: 1.8
>Reporter: Dan Berindei
>
> I have a Maven project using maven-antrun-plugin:
> {code}
> 
> 
>4.0.0
>my-test-app
>my-test-group
>1.0-SNAPSHOT
>
>   
>  
> org.apache.maven.plugins
> maven-antrun-plugin
> 1.8
> 
>
>   compile
>   compile
>   
>  
> 
>
> 
>  
>   
>   
>  run
>   
>
> 
>  
>   
>
> 
> {code}
> The Ant build file uses a script:
> {code}
> 
> 
>
>   
>
>
>   
>
> 
> {code}
> On Java 8 it works, but on Java 9 (9-ea+162) it can't find the script engine:
> {noformat}
> 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 .. @ 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
> {noformat}
> I have attached a debugger and I saw that the {{ScriptEngineManager}} used by 
> {{JavaxScriptRunner}} doesn't have any script engines, because the service 
> loader it uses doesn't find any {{ScriptEngineFactory}} implementations. I 
> have tried {{\--add-modules jdk.scripting.nashorn}} and {{\--add-opens 
> jdk.scripting.nashorn/jdk.nashorn.api.scripting=ALL-UNNAMED}}, but neither 
> helped.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)