maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r768409 - in /maven/components/trunk: maven-model-builder/src/main/java/org/apache/maven/model/ maven-model-builder/src/main/java/org/apache/maven/model/processors/ maven-project/src/test/java/org/apache/maven/project/
Date Fri, 24 Apr 2009 20:07:42 GMT
Author: sisbell
Date: Fri Apr 24 20:07:41 2009
New Revision: 768409

URL: http://svn.apache.org/viewvc?rev=768409&view=rev
Log:
Fix: If its a profile merging into the model, we need to keep adding the dependencies.

Modified:
    maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/ProcessorContext.java
    maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/processors/ModelProcessor.java
    maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java

Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/ProcessorContext.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/ProcessorContext.java?rev=768409&r1=768408&r2=768409&view=diff
==============================================================================
--- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/ProcessorContext.java
(original)
+++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/ProcessorContext.java
Fri Apr 24 20:07:41 2009
@@ -93,7 +93,7 @@
                                        new RepositoriesProcessor(), new DistributionManagementProcessor(),
                                        new LicensesProcessor(), new ScmProcessor(), new PrerequisitesProcessor(),
                                        new ContributorsProcessor(), new DevelopersProcessor(),
new ProfilesProcessor() );
-        Model target = processModelsForInheritance( convertDomainModelsToMavenModels( domainModels
), processors );
+        Model target = processModelsForInheritance( convertDomainModelsToMavenModels( domainModels
), processors, false );
         if(listeners != null)
         {
         	for(ModelEventListener listener : listeners)
@@ -148,7 +148,7 @@
      
         DependencyManagement depMng = model.getDependencyManagement();
         
-        Model target = processModelsForInheritance(profileModels, processors);
+        Model target = processModelsForInheritance(profileModels, processors, true);
 
         PluginsManagementProcessor pmp = new PluginsManagementProcessor();
         if( mng != null )
@@ -219,9 +219,9 @@
         return models;
     }
     
-    private static Model processModelsForInheritance(List<Model> models, List<Processor>
processors)
+    private static Model processModelsForInheritance(List<Model> models, List<Processor>
processors, boolean isProfile)
     {
-        ModelProcessor modelProcessor = new ModelProcessor( processors );
+        ModelProcessor modelProcessor = new ModelProcessor( processors, isProfile );
         Collections.reverse( models );    
 
         int length = models.size();

Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/processors/ModelProcessor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/processors/ModelProcessor.java?rev=768409&r1=768408&r2=768409&view=diff
==============================================================================
--- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/processors/ModelProcessor.java
(original)
+++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/processors/ModelProcessor.java
Fri Apr 24 20:07:41 2009
@@ -37,9 +37,12 @@
     extends BaseProcessor
 {
 
-    public ModelProcessor( Collection<Processor> processors )
+	private boolean isProfile;
+	
+    public ModelProcessor( Collection<Processor> processors, boolean isProfile )
     {
         super( processors );
+        this.isProfile = isProfile;
     }
 
     public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized
)
@@ -146,8 +149,17 @@
              
         if(deps.size() > 0)
         {
-        	t.setDependencies(deps);
-           // t.getDependencies().addAll( deps );
+        	//Multiple profiles may be processed so we need to add them
+        	if(isProfile)
+        	{
+        		t.getDependencies().addAll( deps );	
+        	}
+        	else
+        	{
+        		t.setDependencies(deps);	
+        	}
+        	
+           // 
         }  
         
         //Dependency Management

Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java?rev=768409&r1=768408&r2=768409&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
(original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
Fri Apr 24 20:07:41 2009
@@ -886,15 +886,13 @@
     }
     
     /** IT-0021*/
-    /*
     public void testProfileDependenciesMultipleProfiles()
         throws Exception
     {
         PomTestWrapper pom = buildPom( "profile-dependencies-multiple-profiles", "profile-1",
"profile-2" );
         assertEquals(2,  ( (List<?>) pom.getValue( "dependencies" ) ).size() );
     }    
-    */
-    /*
+
     public void testDependencyInheritance()
         throws Exception
     {
@@ -902,7 +900,7 @@
         assertEquals(1,  ( (List<?>) pom.getValue( "dependencies" ) ).size() );
         assertEquals("4.4",  pom.getValue("dependencies[1]/version") );
     }
-  */
+
     /** MNG-4034 */
     public void testManagedProfileDependency()
         throws Exception



Mime
View raw message