Return-Path: X-Original-To: apmail-maven-dev-archive@www.apache.org Delivered-To: apmail-maven-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7A37210F70 for ; Sun, 11 Jan 2015 19:49:03 +0000 (UTC) Received: (qmail 89983 invoked by uid 500); 11 Jan 2015 19:49:04 -0000 Delivered-To: apmail-maven-dev-archive@maven.apache.org Received: (qmail 89890 invoked by uid 500); 11 Jan 2015 19:49:04 -0000 Mailing-List: contact dev-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Developers List" Reply-To: "Maven Developers List" Delivered-To: mailing list dev@maven.apache.org Received: (qmail 89823 invoked by uid 99); 11 Jan 2015 19:49:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Jan 2015 19:49:03 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [194.158.98.15] (HELO mail-2y.bbox.fr) (194.158.98.15) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Jan 2015 19:48:37 +0000 Received: from herve-desktop.localnet (static-176-183-252-218.ncc.abo.bbox.fr [176.183.252.218]) by mail-2y.bbox.fr (Postfix) with ESMTP id 398D03A9 for ; Sun, 11 Jan 2015 20:48:16 +0100 (CET) From: =?ISO-8859-1?Q?Herv=E9?= BOUTEMY To: Maven Developers List Subject: Re: maven git commit: better plugin/extensions realm parent classloader Date: Sun, 11 Jan 2015 20:48:16 +0100 Message-ID: <2065407.nie9OzZjI5@herve-desktop> User-Agent: KMail/4.13.3 (Linux/3.13.0-43-generic; KDE/4.13.3; x86_64; ; ) In-Reply-To: <54B2B085.80406@ifedorenko.com> References: <23297958.7W1RTh25cN@herve-desktop> <54B2B085.80406@ifedorenko.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Virus-Checked: Checked by ClamAV on apache.org Le dimanche 11 janvier 2015 12:19:01 Igor Fedorenko a =E9crit : > Opened https://jira.codehaus.org/browse/MNG-5752, thank you for the > reminder. thank you: I now better understand the reasoning >=20 > The change does not affect classloading of "normal" maven runtime, so= > there is no need to update the diagram or documentation. IIUC, in the Wiki, what is currently described as "system classloader" = is now=20 "initial classloader, containing classworlds", which is the system when= using=20 CLI but may be another classloader in other situations where Maven is=20= integrated > Speaking of > which, that documentation is somewhat outdated and does not mention c= ore > extensions realm, for example. I meant to update it some time ago, bu= t > could not find the sources of the diagram. Does anyone know where the= y are? if you look at attachements, there is a svg associated with the png ima= ge >=20 > I do not believe this change deserves dedicated integration test, at > least not in maven. There is only so many ways you can access system > classloader and if anyone decides to change this in the future javado= c > comment should give enough context. ok Regards, Herv=E9 >=20 > -- > Regards, > Igor >=20 > On 2015-01-11 11:17, Herv=E9 BOUTEMY wrote: > > please: > > 1. create a Jira issue > > 2. update our Class loading documentation [1] with MNG and Maven ve= rsion > > reference > >=20 > > then ideally, having a core IT to show what difference is expected = from > > new > > code would be great (I don't know how hard this one can be) > >=20 > > Regards, > >=20 > > Herv=E9 > >=20 > >=20 > > [1] > > https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Class+L= oading>=20 > > Le jeudi 8 janvier 2015 13:09:10 ifedorenko@apache.org a =E9crit : > >> Repository: maven > >>=20 > >> Updated Branches: > >> refs/heads/master 5f71f9789 -> bb4988496 > >>=20 > >> better plugin/extensions realm parent classloader > >>=20 > >> Signed-off-by: Igor Fedorenko > >>=20 > >>=20 > >> Project: http://git-wip-us.apache.org/repos/asf/maven/repo > >> Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/bb4988= 49 > >> Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/bb498849 > >> Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/bb498849 > >>=20 > >> Branch: refs/heads/master > >> Commit: bb4988496a0e3b50ee5a1922bcd54f731eb2d5b2 > >> Parents: 5f71f97 > >> Author: Igor Fedorenko > >> Authored: Thu Jan 8 08:08:42 2015 -0500 > >> Committer: Igor Fedorenko > >> Committed: Thu Jan 8 08:08:47 2015 -0500 > >>=20 > >> ------------------------------------------------------------------= ---- > >>=20 > >> .../maven/classrealm/DefaultClassRealmManager.java | 14 > >> ++++++++++++-- > >> 1 file changed, 12 insertions(+), 2 deletions(-) > >>=20 > >> ------------------------------------------------------------------= ---- > >>=20 > >>=20 > >> http://git-wip-us.apache.org/repos/asf/maven/blob/bb498849/maven-c= ore/src > >> /ma in/java/org/apache/maven/classrealm/DefaultClassRealmManager.j= ava > >> ------------------------------------------------------------------= ---- > >> diff > >> --git > >> a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClas= sRealmM > >> an > >> ager.java > >> b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClas= sRealmM > >> an > >> ager.java index 3584d53..a5bb352 100644 > >> --- > >> a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClas= sRealmM > >> an > >> ager.java +++ > >> b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClas= sRealmM > >> an > >> ager.java @@ -59,6 +59,16 @@ public class DefaultClassRealmManager= > >>=20 > >> implements ClassRealmManager > >> =20 > >> { > >>=20 > >> + /** > >> + * During normal command line build, ClassWorld is loaded by = jvm > >> system classloader, which only includes + * plexus-classworlds= jar > >> and possibly javaagent classes, see > >> http://jira.codehaus.org/browse/MNG-4747. +>>=20 > >> *

> >>=20 > >> + * Using ClassWorld to determine plugin/extensions realm pare= nt > >> classloaders gives m2e and integration test harness + * flexib= ility > >> to > >> load multiple version of maven into dedicated classloaders without= > >> assuming > >> state of jvm system + * classloader. > >> + */ > >> + private static final ClassLoader PARENT_CLASSLOADER =3D > >> ClassWorld.class.getClassLoader(); + > >>=20 > >> @Requirement > >> private Logger logger; > >>=20 > >> @@ -329,7 +339,7 @@ public class DefaultClassRealmManager > >>=20 > >> throw new IllegalArgumentException( "extension plugi= n > >> missing" > >>=20 > >> ); } > >>=20 > >> - ClassLoader parent =3D ClassLoader.getSystemClassLoader()= ; > >> + ClassLoader parent =3D PARENT_CLASSLOADER; > >>=20 > >> Map foreignImports =3D > >> =20 > >> Collections.singletonMap( "", > >>=20 > >> getMavenApiRealm() ); @@ -347,7 +357,7 @@ public class > >> DefaultClassRealmManager > >>=20 > >> if ( parent =3D=3D null ) > >> { > >>=20 > >> - parent =3D ClassLoader.getSystemClassLoader(); > >> + parent =3D PARENT_CLASSLOADER; > >>=20 > >> } > >> =20 > >> return createRealm( getKey( plugin, false ), RealmType.P= lugin, > >>=20 > >> parent, parentImports, foreignImports, artifacts ); > >=20 > > -------------------------------------------------------------------= -- > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org > > For additional commands, e-mail: dev-help@maven.apache.org >=20 > ---------------------------------------------------------------------= > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org > For additional commands, e-mail: dev-help@maven.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org For additional commands, e-mail: dev-help@maven.apache.org