maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r422081 - in /maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap: Bootstrap.java model/Model.java model/ModelReader.java model/ProjectResolver.java
Date Fri, 14 Jul 2006 22:32:29 GMT
Author: brett
Date: Fri Jul 14 15:32:29 2006
New Revision: 422081

URL: http://svn.apache.org/viewvc?rev=422081&view=rev
Log:
[MNG-2447] fix the bootstrap by adding plugin management support for modello since the versions
were rationalised
Submitted by: Pete Marvin King

Modified:
    maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java
    maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/Model.java
    maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ModelReader.java
    maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ProjectResolver.java

Modified: maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java?rev=422081&r1=422080&r2=422081&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java
(original)
+++ maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/Bootstrap.java
Fri Jul 14 15:32:29 2006
@@ -322,6 +322,20 @@
 
             System.out.println( "Model exists!" );
 
+            // acquire the version from the parent pom pluginManagement
+            String version = plugin.getVersion();
+            if ( ( version == null ) || ( version == "" ) )
+            {
+                Plugin managedPlugin = (Plugin) model.getManagedPlugins().get( MODELLO_PLUGIN_ID
);
+                
+                if ( managedPlugin == null )
+                {
+                    throw new Exception( "can not determine version of " + MODELLO_PLUGIN_ID
);	
+                }
+                
+                plugin.setVersion( managedPlugin.getVersion() );
+            }
+            
             String modelVersion = (String) plugin.getConfiguration().get( "version" );
             if ( modelVersion == null || modelVersion.trim().length() < 1 )
             {

Modified: maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/Model.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/Model.java?rev=422081&r1=422080&r2=422081&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/Model.java
(original)
+++ maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/Model.java
Fri Jul 14 15:32:29 2006
@@ -65,6 +65,8 @@
 
     private Map managedDependencies = new HashMap();
 
+    private Map managedPlugins = new HashMap();    
+    
     private List chain;
 
     public Model()
@@ -224,6 +226,19 @@
         return m.values();
     }
 
+    public Map getManagedPlugins()
+    {
+        return managedPlugins;
+    }
+
+    public Collection getManagedPluginsCollection()
+    {
+        Map m = new HashMap();
+        m.putAll( managedPlugins );
+        return m.values();
+    }
+    
+    
     public String toString()
     {
         return "Model[" + getId() + "]";

Modified: maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ModelReader.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ModelReader.java?rev=422081&r1=422080&r2=422081&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ModelReader.java
(original)
+++ maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ModelReader.java
Fri Jul 14 15:32:29 2006
@@ -64,6 +64,8 @@
     private boolean insideDependencyManagement;
 
     private boolean insideDistributionManagement;
+    
+    private boolean insidePluginManagement;
 
     private boolean insideReleases;
 
@@ -141,6 +143,11 @@
 
             insidePlugin = true;
         }
+        else if ( rawName.equals( "pluginManagement" ) )
+        {
+            insidePluginManagement = true;
+        }
+        
         else if ( rawName.equals( "dependencyManagement" ) )
         {
             insideDependencyManagement = true;
@@ -230,6 +237,7 @@
 
             ProjectResolver.addDependencies( p.getManagedDependenciesCollection(), model.getManagedDependencies(),
inheritedScope, Collections.EMPTY_SET );
 
+            ProjectResolver.addPluginManagement( p.getManagedPluginsCollection(), model.getManagedPlugins()
);            
             model.getRepositories().addAll( p.getRepositories() );
 
             model.getResources().addAll( p.getResources() );
@@ -279,8 +287,15 @@
         }
         else if ( rawName.equals( "plugin" ) )
         {
-            model.getPlugins().put( currentPlugin.getId(), currentPlugin );
-
+            if (insidePluginManagement)
+            {
+                model.getManagedPlugins().put( currentPlugin.getId(), currentPlugin );
+            }
+            else
+            {
+                model.getPlugins().put( currentPlugin.getId(), currentPlugin );
+            }
+        	    
             insidePlugin = false;
         }
         else if ( rawName.equals( "build" ) )

Modified: maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ProjectResolver.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ProjectResolver.java?rev=422081&r1=422080&r2=422081&view=diff
==============================================================================
--- maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ProjectResolver.java
(original)
+++ maven/components/trunk/bootstrap/bootstrap-mini/src/main/java/org/apache/maven/bootstrap/model/ProjectResolver.java
Fri Jul 14 15:32:29 2006
@@ -116,6 +116,16 @@
         }
     }
 
+    public static void addPluginManagement( Collection plugins, Map target)
+    {
+    	    Plugin managedPlugin;
+    	    for (Iterator i = plugins.iterator(); i.hasNext(); )
+    	    {
+    	    	    managedPlugin = (Plugin) i.next();
+    	    	    target.put(managedPlugin.getId(),managedPlugin);    	    	    
+    	    }
+    }
+    
     private static boolean hasDependency( Dependency d, Map dependencies )
     {
         String conflictId = d.getConflictId();



Mime
View raw message