Re: maven git commit: better plugin/extensions realm parent classloader

2015-01-11 Thread Igor Fedorenko

Opened https://jira.codehaus.org/browse/MNG-5752, thank you for the
reminder.

The change does not affect classloading of normal maven runtime, so
there is no need to update the diagram or documentation. Speaking of
which, that documentation is somewhat outdated and does not mention core
extensions realm, for example. I meant to update it some time ago, but
could not find the sources of the diagram. Does anyone know where they are?

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 javadoc
comment should give enough context.

--
Regards,
Igor

On 2015-01-11 11:17, Hervé BOUTEMY wrote:

please:
1. create a Jira issue
2. update our Class loading documentation [1] with MNG and Maven version
reference

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)

Regards,

Hervé


[1] https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Class+Loading

Le jeudi 8 janvier 2015 13:09:10 ifedore...@apache.org a écrit :

Repository: maven
Updated Branches:
   refs/heads/master 5f71f9789 - bb4988496


better plugin/extensions realm parent classloader

Signed-off-by: Igor Fedorenko ifedore...@apache.org


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/bb498849
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/bb498849
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/bb498849

Branch: refs/heads/master
Commit: bb4988496a0e3b50ee5a1922bcd54f731eb2d5b2
Parents: 5f71f97
Author: Igor Fedorenko ifedore...@apache.org
Authored: Thu Jan 8 08:08:42 2015 -0500
Committer: Igor Fedorenko ifedore...@apache.org
Committed: Thu Jan 8 08:08:47 2015 -0500

--
  .../maven/classrealm/DefaultClassRealmManager.java| 14 --
  1 file changed, 12 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/maven/blob/bb498849/maven-core/src/ma
in/java/org/apache/maven/classrealm/DefaultClassRealmManager.java
-- diff
--git
a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmMan
ager.java
b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmMan
ager.java index 3584d53..a5bb352 100644
---
a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmMan
ager.java +++
b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmMan
ager.java @@ -59,6 +59,16 @@ public class DefaultClassRealmManager
  implements ClassRealmManager
  {

+/**
+ * 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. +
 * p
+ * Using ClassWorld to determine plugin/extensions realm parent
classloaders gives m2e and integration test harness + * flexibility to
load multiple version of maven into dedicated classloaders without assuming
state of jvm system + * classloader.
+ */
+private static final ClassLoader PARENT_CLASSLOADER =
ClassWorld.class.getClassLoader(); +
  @Requirement
  private Logger logger;

@@ -329,7 +339,7 @@ public class DefaultClassRealmManager
  throw new IllegalArgumentException( extension plugin missing
); }

-ClassLoader parent = ClassLoader.getSystemClassLoader();
+ClassLoader parent = PARENT_CLASSLOADER;

  MapString, ClassLoader foreignImports =
  Collections.String, ClassLoadersingletonMap( ,
getMavenApiRealm() ); @@ -347,7 +357,7 @@ public class
DefaultClassRealmManager

  if ( parent == null )
  {
-parent = ClassLoader.getSystemClassLoader();
+parent = PARENT_CLASSLOADER;
  }

  return createRealm( getKey( plugin, false ), RealmType.Plugin,
parent, parentImports, foreignImports, artifacts );



-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



Re: maven git commit: better plugin/extensions realm parent classloader

2015-01-11 Thread Hervé BOUTEMY
Le dimanche 11 janvier 2015 12:19:01 Igor Fedorenko a écrit :
 Opened https://jira.codehaus.org/browse/MNG-5752, thank you for the
 reminder.
thank you: I now better understand the reasoning

 
 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 
initial classloader, containing classworlds, which is the system when using 
CLI but may be another classloader in other situations where Maven is 
integrated

 Speaking of
 which, that documentation is somewhat outdated and does not mention core
 extensions realm, for example. I meant to update it some time ago, but
 could not find the sources of the diagram. Does anyone know where they are?
if you look at attachements, there is a svg associated with the png image

 
 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 javadoc
 comment should give enough context.
ok

Regards,

Hervé

 
 --
 Regards,
 Igor
 
 On 2015-01-11 11:17, Hervé BOUTEMY wrote:
  please:
  1. create a Jira issue
  2. update our Class loading documentation [1] with MNG and Maven version
  reference
  
  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)
  
  Regards,
  
  Hervé
  
  
  [1]
  https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Class+Loading 
  Le jeudi 8 janvier 2015 13:09:10 ifedore...@apache.org a écrit :
  Repository: maven
  
  Updated Branches:
 refs/heads/master 5f71f9789 - bb4988496
  
  better plugin/extensions realm parent classloader
  
  Signed-off-by: Igor Fedorenko ifedore...@apache.org
  
  
  Project: http://git-wip-us.apache.org/repos/asf/maven/repo
  Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/bb498849
  Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/bb498849
  Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/bb498849
  
  Branch: refs/heads/master
  Commit: bb4988496a0e3b50ee5a1922bcd54f731eb2d5b2
  Parents: 5f71f97
  Author: Igor Fedorenko ifedore...@apache.org
  Authored: Thu Jan 8 08:08:42 2015 -0500
  Committer: Igor Fedorenko ifedore...@apache.org
  Committed: Thu Jan 8 08:08:47 2015 -0500
  
  --
  
.../maven/classrealm/DefaultClassRealmManager.java| 14
--
1 file changed, 12 insertions(+), 2 deletions(-)
  
  --
  
  
  http://git-wip-us.apache.org/repos/asf/maven/blob/bb498849/maven-core/src
  /ma in/java/org/apache/maven/classrealm/DefaultClassRealmManager.java
  --
  diff
  --git
  a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmM
  an
  ager.java
  b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmM
  an
  ager.java index 3584d53..a5bb352 100644
  ---
  a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmM
  an
  ager.java +++
  b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmM
  an
  ager.java @@ -59,6 +59,16 @@ public class DefaultClassRealmManager
  
implements ClassRealmManager

{
  
  +/**
  + * 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. + 
   * p
  
  + * Using ClassWorld to determine plugin/extensions realm parent
  classloaders gives m2e and integration test harness + * flexibility
  to
  load multiple version of maven into dedicated classloaders without
  assuming
  state of jvm system + * classloader.
  + */
  +private static final ClassLoader PARENT_CLASSLOADER =
  ClassWorld.class.getClassLoader(); +
  
@Requirement
private Logger logger;
  
  @@ -329,7 +339,7 @@ public class DefaultClassRealmManager
  
throw new IllegalArgumentException( extension plugin
missing
  
  ); }
  
  -ClassLoader parent = ClassLoader.getSystemClassLoader();
  +ClassLoader parent = PARENT_CLASSLOADER;
  
MapString, ClassLoader foreignImports =

Collections.String, ClassLoadersingletonMap( ,
  
  getMavenApiRealm() ); @@ -347,7 +357,7 @@ public class
  DefaultClassRealmManager
  
if ( parent == null )
{
  
  -parent = ClassLoader.getSystemClassLoader();
  +parent = PARENT_CLASSLOADER;
  
}

return createRealm( getKey( plugin, false ), RealmType.Plugin,
  
  parent, parentImports, foreignImports, artifacts );
  
  

Re: maven git commit: better plugin/extensions realm parent classloader

2015-01-11 Thread Igor Fedorenko



On 2015-01-11 14:48, Hervé BOUTEMY wrote:

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
initial classloader, containing classworlds, which is the system when using
CLI but may be another classloader in other situations where Maven is
integrated



The change does not affect what is described as System Class Loader at
all. It only affects the parent of Project Class Loader and Plugin
Class Loader and only when Maven is embedded in other runtimes. The
wiki does not document the plugin/project classloader parent and it
explicitly avoids talking about embedding scenarios. The change is out
of scope of the information provided on the wiki.


Speaking of
which, that documentation is somewhat outdated and does not mention core
extensions realm, for example. I meant to update it some time ago, but
could not find the sources of the diagram. Does anyone know where they are?

if you look at attachements, there is a svg associated with the png image



Unfortunately, I am not fluent enough in SVG to make the changes (and
the file looks generated to me).

--
Regards,
Igor

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org