Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A913C200497 for ; Wed, 23 Aug 2017 19:31:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A593A1693ED; Wed, 23 Aug 2017 17:31:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C77771693E9 for ; Wed, 23 Aug 2017 19:31:06 +0200 (CEST) Received: (qmail 18235 invoked by uid 500); 23 Aug 2017 17:31:04 -0000 Mailing-List: contact issues-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list issues@maven.apache.org Received: (qmail 18224 invoked by uid 99); 23 Aug 2017 17:31:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Aug 2017 17:31:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 49C22C01E5 for ; Wed, 23 Aug 2017 17:31:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -98.702 X-Spam-Level: X-Spam-Status: No, score=-98.702 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_NUMSUBJECT=0.5, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id dU_d8p-s1idI for ; Wed, 23 Aug 2017 17:31:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id EC22761DB2 for ; Wed, 23 Aug 2017 17:31:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 0FF80E0D49 for ; Wed, 23 Aug 2017 17:31:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 5F35925386 for ; Wed, 23 Aug 2017 17:31:00 +0000 (UTC) Date: Wed, 23 Aug 2017 17:31:00 +0000 (UTC) From: =?utf-8?Q?Guillaume_Bou=C3=A9_=28JIRA=29?= To: issues@maven.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (MANTRUN-200) Scriptdef tasks fail to load when running on Java9 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 23 Aug 2017 17:31:07 -0000 [ https://issues.apache.org/jira/browse/MANTRUN-200?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D161= 38712#comment-16138712 ]=20 Guillaume Bou=C3=A9 commented on MANTRUN-200: ---------------------------------------- [~rfscholte] Yes, the parent used by ServiceLoader to delegate is returned = by {{getParent()}}, and this is {{null}}. Just considering modules, it mean= s only services present in modules loaded by the bootstrap classloader are = found. I think Nashorn is loaded with the system classloader in Java 9 (and= was previously loaded with bootstrap classloader). So from what I gathered= , passing the system classloader, instead of {{null}}, in {{world.newRealm(= realmId, null )}} would solve this Jira issue, meaning the Nashorn impleme= ntation would be found (I tested this previously and it really solves it). But I'm afraid it would just hide another issue: a module loaded by the Mav= en core extension classloader still would not be found. For that, I believe= you would need to pass Core Ext classloader as parent in {{world.newRealm(= realmId, null )}}, or even pass whatever {{parent}} was passed to {{create= Realm}} in {{DefaultClassRealmManager}}, but I tested that this has bad con= sequences for plugins using the Site Plugin. The problem was that the searc= h for a given class would now delegate to the parent first and then plugin = classloader. In the case of the Site Plugin, the parent would be the Site P= lugin's realm, and this would mean that it is the classes loaded by maven-s= ite that are found before the ones of the plugin itself...and this quickly = turned into version conflicts and ClassNotFoundException when the plugin ov= errides a dependency... > 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} > > > > var System =3D Java.type('java.lang.System'); > System.out.println("Working!"); > ]]> > > > > > > {code} > On Java 8 it works, but on Java 9 (9-ea+162) it can't find the script eng= ine: > {noformat} > org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute= goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (compile) on pro= ject my-test-app: An Ant BuildException has occured: The following error oc= curred while executing this line: > /home/dan/scriptdef-test/build.xml:10: Unable to create javax script engi= ne for javascript > around Ant part ...... @ = 4:47 in /home/dan/scriptdef-test/target/antrun/build-main.xml > ... =20 > 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.evaluateScrip= t(JavaxScriptRunner.java:84) > at org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript= (JavaxScriptRunner.java:67) > at org.apache.tools.ant.taskdefs.optional.script.ScriptDef.executeScr= ipt(ScriptDef.java:350) > at org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase.execut= e(ScriptDefBase.java:50) > at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:29= 2) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Na= tive Method) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Nat= iveMethodAccessorImpl.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:139= 3) > at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(Sin= gleCheckExecutor.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}} use= d by {{JavaxScriptRunner}} doesn't have any script engines, because the ser= vice loader it uses doesn't find any {{ScriptEngineFactory}} implementation= s. I have tried {{\--add-modules jdk.scripting.nashorn}} and {{\--add-opens= jdk.scripting.nashorn/jdk.nashorn.api.scripting=3DALL-UNNAMED}}, but neith= er helped. -- This message was sent by Atlassian JIRA (v6.4.14#64029)