maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r1059266 - in /maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin: DefaultPluginRealmCache.java PluginRealmCache.java internal/DefaultMavenPluginManager.java
Date Sat, 15 Jan 2011 05:26:00 GMT
Author: bentmann
Date: Sat Jan 15 05:25:59 2011
New Revision: 1059266

URL: http://svn.apache.org/viewvc?rev=1059266&view=rev
Log:
[MNG-4973] [regression] Build extensions are invisible to plugins in multi module build

Modified:
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java?rev=1059266&r1=1059265&r2=1059266&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
Sat Jan 15 05:25:59 2011
@@ -58,13 +58,13 @@ public class DefaultPluginRealmCache
 
         private final ClassLoader parentRealm;
 
-        private final List<String> parentImports;
+        private final Map<String, ClassLoader> foreignImports;
 
         private final DependencyFilter filter;
 
         private final int hashCode;
 
-        public CacheKey( Plugin plugin, ClassLoader parentRealm, List<String> parentImports,
+        public CacheKey( Plugin plugin, ClassLoader parentRealm, Map<String, ClassLoader>
foreignImports,
                          DependencyFilter dependencyFilter, List<RemoteRepository>
repositories,
                          RepositorySystemSession session )
         {
@@ -84,7 +84,8 @@ public class DefaultPluginRealmCache
                 }
             }
             this.parentRealm = parentRealm;
-            this.parentImports = ( parentImports != null ) ? parentImports : Collections.<String>
emptyList();
+            this.foreignImports =
+                ( foreignImports != null ) ? foreignImports : Collections.<String, ClassLoader>
emptyMap();
             this.filter = dependencyFilter;
 
             int hash = 17;
@@ -93,7 +94,7 @@ public class DefaultPluginRealmCache
             hash = hash * 31 + hash( localRepo );
             hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
             hash = hash * 31 + hash( parentRealm );
-            hash = hash * 31 + this.parentImports.hashCode();
+            hash = hash * 31 + this.foreignImports.hashCode();
             hash = hash * 31 + hash( dependencyFilter );
             this.hashCode = hash;
         }
@@ -133,7 +134,7 @@ public class DefaultPluginRealmCache
             return parentRealm == that.parentRealm && CacheUtils.pluginEquals( plugin,
that.plugin )
                 && eq( workspace, that.workspace ) && eq( localRepo, that.localRepo
)
                 && CacheUtils.repositoriesEquals( this.repositories, that.repositories
) && eq( filter, that.filter )
-                && eq( parentImports, that.parentImports );
+                && eq( foreignImports, that.foreignImports );
         }
 
         private static <T> boolean eq( T s1, T s2 )
@@ -145,11 +146,11 @@ public class DefaultPluginRealmCache
 
     protected final Map<Key, CacheRecord> cache = new ConcurrentHashMap<Key, CacheRecord>();
 
-    public Key createKey( Plugin plugin, ClassLoader parentRealm, List<String> parentImports,
+    public Key createKey( Plugin plugin, ClassLoader parentRealm, Map<String, ClassLoader>
foreignImports,
                           DependencyFilter dependencyFilter, List<RemoteRepository>
repositories,
                           RepositorySystemSession session )
     {
-        return new CacheKey( plugin, parentRealm, parentImports, dependencyFilter, repositories,
session );
+        return new CacheKey( plugin, parentRealm, foreignImports, dependencyFilter, repositories,
session );
     }
 
     public CacheRecord get( Key key )

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java?rev=1059266&r1=1059265&r2=1059266&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java
Sat Jan 15 05:25:59 2011
@@ -20,6 +20,7 @@ package org.apache.maven.plugin;
  */
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.model.Plugin;
@@ -61,8 +62,9 @@ public interface PluginRealmCache
         // marker interface for cache keys
     }
 
-    Key createKey( Plugin plugin, ClassLoader parentRealm, List<String> parentImports,
-                   DependencyFilter dependencyFilter, List<RemoteRepository> repositories,
RepositorySystemSession session );
+    Key createKey( Plugin plugin, ClassLoader parentRealm, Map<String, ClassLoader>
foreignImports,
+                   DependencyFilter dependencyFilter, List<RemoteRepository> repositories,
+                   RepositorySystemSession session );
 
     CacheRecord get( Key key );
 

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java?rev=1059266&r1=1059265&r2=1059266&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
Sat Jan 15 05:25:59 2011
@@ -299,8 +299,10 @@ public class DefaultMavenPluginManager
 
         MavenProject project = session.getCurrentProject();
 
+        Map<String, ClassLoader> foreignImports = calcImports( project, parent, imports
);
+
         PluginRealmCache.Key cacheKey =
-            pluginRealmCache.createKey( plugin, parent, imports, filter, project.getRemotePluginRepositories(),
+            pluginRealmCache.createKey( plugin, parent, foreignImports, filter, project.getRemotePluginRepositories(),
                                         session.getRepositorySession() );
 
         PluginRealmCache.CacheRecord cacheRecord = pluginRealmCache.get( cacheKey );
@@ -312,7 +314,7 @@ public class DefaultMavenPluginManager
         }
         else
         {
-            createPluginRealm( pluginDescriptor, session, parent, imports, filter );
+            createPluginRealm( pluginDescriptor, session, parent, foreignImports, filter
);
 
             cacheRecord =
                 pluginRealmCache.put( cacheKey, pluginDescriptor.getClassRealm(), pluginDescriptor.getArtifacts()
);
@@ -322,7 +324,7 @@ public class DefaultMavenPluginManager
     }
 
     private void createPluginRealm( PluginDescriptor pluginDescriptor, MavenSession session,
ClassLoader parent,
-                                    List<String> imports, DependencyFilter filter )
+                                    Map<String, ClassLoader> foreignImports, DependencyFilter
filter )
         throws PluginResolutionException, PluginContainerException
     {
         Plugin plugin = pluginDescriptor.getPlugin();
@@ -365,8 +367,6 @@ public class DefaultMavenPluginManager
 
         List<org.sonatype.aether.artifact.Artifact> pluginArtifacts = nlg.getArtifacts(
true );
 
-        Map<String, ClassLoader> foreignImports = calcImports( project, parent, imports
);
-
         ClassRealm pluginRealm =
             classRealmManager.createPluginRealm( plugin, parent, null, foreignImports, pluginArtifacts
);
 



Mime
View raw message