maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r757526 - in /maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor: DependenciesProcessor.java DependencyProcessor.java PluginProcessor.java
Date Mon, 23 Mar 2009 20:09:25 GMT
Author: sisbell
Date: Mon Mar 23 20:09:24 2009
New Revision: 757526

URL: http://svn.apache.org/viewvc?rev=757526&view=rev
Log:
Fixed plugin dependency ordering.

Modified:
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/DependenciesProcessor.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/DependencyProcessor.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/PluginProcessor.java

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/DependenciesProcessor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/DependenciesProcessor.java?rev=757526&r1=757525&r2=757526&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/DependenciesProcessor.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/DependenciesProcessor.java
Mon Mar 23 20:09:24 2009
@@ -24,9 +24,7 @@
 import java.util.List;
 
 import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Model;
-import org.apache.maven.project.builder.ProjectUri;
-import org.apache.maven.shared.model.ModelContainerAction;
+
 
 public class DependenciesProcessor
     extends BaseProcessor
@@ -61,18 +59,8 @@
                 {
                     for ( Dependency parentDependency : p)
                     {
-                        /*
-                        if ( match( childDependency, parentDependency ) )
-                        {
-                            processor.process( null, childDependency, dependencies, isChildMostSpecialized
);
-                            childDependencies.add( parentDependency );
-                        }
-                        else
-                        {
-                        */
-                            processor.process( null, childDependency, dependencies, isChildMostSpecialized
);
-                            childDependencies.add( parentDependency );
-    
+                        processor.process( null, childDependency, dependencies, isChildMostSpecialized
);
+                        childDependencies.add( parentDependency );
                     }
                 }
 
@@ -88,71 +76,6 @@
                     processor.process( d2, null, dependencies, isChildMostSpecialized );
                 }
             }
-        }
-        
-        //Cleanup duplicates
-        List<Dependency> ordered = new ArrayList<Dependency>(dependencies);
-       // Collections.reverse( ordered );
-        for(Dependency dependency : ordered)
-        {
-            for(int i = ordered.indexOf( dependency ) + 1; i < ordered.size(); i++)
-            {
-                Dependency d1 = ordered.get( i );
-                if(match1(d1, dependency))
-                {
-                   // System.out.println("REMOVE:" + d1.getManagementKey() + ":" + d1.getVersion());
-                 //   dependencies.remove( d1 );    
-                }
-            }
-        }
-        
-    }
-
-    private static boolean contains(Dependency dependency, List<Dependency> dependencies)
-    {     
-        return false;
-    }
-
-    private boolean match1(Dependency d1, Dependency d2)
-    {
-         return getId( d1 ).equals( getId( d2 ) );
-    }
-
-    /*
-    private boolean match(Dependency d1, Dependency d2)
-    {
-        if(isManagement)
-        {
-            return d1.getGroupId().equals( d2.getGroupId() ) && d1.getArtifactId().equals(
d2.getArtifactId() );
-        }
-        else
-        {
-            return d1.getGroupId().equals( d2.getGroupId() ) && d1.getArtifactId().equals(
d2.getArtifactId() ) && d2.getVersion().equals(d1.getVersion());
-        }
-    }
-    */
-    private boolean match( Dependency d1, Dependency d2 )
-    {
-        // TODO: Version ranges ?
-        if ( getId( d1 ).equals( getId( d2 ) ) )
-        {
-            return ( d1.getVersion() == null ? "" : d1.getVersion() ).equals( d2.getVersion()
== null ? ""
-                            : d2.getVersion() );
-        }
-        return false;
-    }
-
-    private String getId( Dependency d )
-    {
-        StringBuilder sb = new StringBuilder();
-        
-        sb.append( d.getGroupId() ).append( ":" ).append( d.getArtifactId() );
-        sb.append( ":" ).append(
-                                     d.getType() == null ? "jar"
-                                                     : "" ).append(
-                                                                    ":" ).append(
-                                                                                  d.getClassifier()
);
-        
-        return sb.toString();
+        }      
     }
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/DependencyProcessor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/DependencyProcessor.java?rev=757526&r1=757525&r2=757526&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/DependencyProcessor.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/DependencyProcessor.java
Mon Mar 23 20:09:24 2009
@@ -50,7 +50,6 @@
             {
                 isAdd = false;
             }
-            //Dependency targetDependency = new Dependency();
             copy( (Dependency) child, targetDependency, false );
             if(isAdd) t.add( targetDependency );
         }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/PluginProcessor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/PluginProcessor.java?rev=757526&r1=757525&r2=757526&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/PluginProcessor.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/processor/PluginProcessor.java
Mon Mar 23 20:09:24 2009
@@ -53,7 +53,8 @@
                 isAdd = false;
             }
             
-            copy( (Plugin) child, targetPlugin, isChildMostSpecialized );
+            copy( (Plugin) child, targetPlugin, true );
+            copyDependencies( (Plugin) child, targetPlugin, true );
             if(isAdd) t.add( targetPlugin );
         }
         else if ( parent != null && child == null )
@@ -70,6 +71,7 @@
             }
             
             copy( (Plugin) parent, targetPlugin, false );
+            copyDependencies( (Plugin) parent, targetPlugin, false );
             if(isAdd) t.add( targetPlugin );
         }
         else
@@ -88,14 +90,20 @@
                     isAdd = false;
                 }                 
                 copy( (Plugin) parent, targetPlugin, false );
-                copy( (Plugin) child, targetPlugin, isChildMostSpecialized );
+                copy( (Plugin) child, targetPlugin, true );
+                
+                copyDependencies( (Plugin) child, targetPlugin, true );
+                copyDependencies( (Plugin) parent, targetPlugin, false );
                 if(isAdd) t.add( targetPlugin ); 
             } 
             else
             {
                 Plugin targetPlugin = new Plugin();
                 copy( (Plugin) parent, targetPlugin, false );
-                copy( (Plugin) child, targetPlugin, isChildMostSpecialized );
+                copy( (Plugin) child, targetPlugin, true );
+                
+                copyDependencies( (Plugin) child, targetPlugin, true );
+                copyDependencies( (Plugin) parent, targetPlugin, false );
                 t.add( targetPlugin );    
             }  
         }       
@@ -123,7 +131,15 @@
         StringBuilder sb = new StringBuilder();
         sb.append( d.getGroupId() ).append( ":" ).append( d.getArtifactId() ).append( ":"
);
         return sb.toString();
-    }       
+    }    
+    
+    
+    private static void copyDependencies(Plugin source, Plugin target, boolean isChild)
+    {
+        DependenciesProcessor proc = new DependenciesProcessor();
+        proc.process( new ArrayList<Dependency>(), new ArrayList<Dependency>(source.getDependencies()),
target.getDependencies(), isChild );            
+    }
+    
     
     private static void copy(Plugin source, Plugin target, boolean isChild)
     {
@@ -166,16 +182,7 @@
             
         }
      
-        DependenciesProcessor proc = new DependenciesProcessor();
-        if(target.getDependencies().isEmpty())
-        {
-            
-            proc.process( new ArrayList<Dependency>(), new ArrayList<Dependency>(source.getDependencies()),
target.getDependencies(), false );            
-        }
-        else
-        {
-            proc.process( new ArrayList<Dependency>(source.getDependencies()), new
ArrayList<Dependency>(), target.getDependencies(), false );            
-        }
+
 
         if(source.getConfiguration() != null)
         {



Mime
View raw message