You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by si...@apache.org on 2009/04/22 21:39:18 UTC

svn commit: r767633 - in /maven/components/trunk: maven-core/src/test/java/org/apache/maven/settings/ maven-model-builder/src/main/java/org/apache/maven/model/processors/ maven-project/src/test/java/org/apache/maven/project/ maven-project/src/test/reso...

Author: sisbell
Date: Wed Apr 22 19:39:18 2009
New Revision: 767633

URL: http://svn.apache.org/viewvc?rev=767633&view=rev
Log:
Fix for IT-21. When we had multiple profiles with dependencies would only include dependencies from last profile.

Added:
    maven/components/trunk/maven-project/src/test/resources-project-builder/profile-dependencies-multiple-profiles/
    maven/components/trunk/maven-project/src/test/resources-project-builder/profile-dependencies-multiple-profiles/pom.xml
Modified:
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.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-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java?rev=767633&r1=767632&r2=767633&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java Wed Apr 22 19:39:18 2009
@@ -56,12 +56,10 @@
     	assertEquals("settings", pom.getValue( "properties/pomVsSettingsInterpolated" ) );
     }    
     
-    /**MNG-4107 */
     public void testRepositories() throws Exception
     {
     	PomTestWrapper pom = buildPom( "repositories" );
     	assertEquals("maven-core-it-0", pom.getValue( "repositories[1]/id" ));
-    	System.out.println(pom.getDomainModel().asString());
     }       
 
     private PomTestWrapper buildPom( String pomPath )

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=767633&r1=767632&r2=767633&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 Wed Apr 22 19:39:18 2009
@@ -146,8 +146,8 @@
              
         if(deps.size() > 0)
         {
-        	t.setDependencies(deps);
-           // t.getDependencies().addAll( deps );
+        	//t.setDependencies(deps);
+            t.getDependencies().addAll( 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=767633&r1=767632&r2=767633&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 Wed Apr 22 19:39:18 2009
@@ -885,6 +885,14 @@
         assertEquals( "d", pom.getValue( "dependencies[4]/artifactId" ) );
     }
     
+    /** 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
     {
@@ -1401,8 +1409,15 @@
 	{
 	    PomTestWrapper pom = this.buildPom( "distribution-management");
 	    assertEquals("legacy", pom.getValue( "distributionManagement/repository/layout" ));
-}     
-    
+	}   
+ /*   
+    public void testRelativePath()
+	    throws Exception
+	{
+	    PomTestWrapper pom = this.buildPom( "relative-path/C");
+	    System.out.println(pom.getDomainModel().asString());
+	}      
+*/    
     private void assertPathSuffixEquals( String expected, Object actual )
     {
         String a = actual.toString();

Added: maven/components/trunk/maven-project/src/test/resources-project-builder/profile-dependencies-multiple-profiles/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/profile-dependencies-multiple-profiles/pom.xml?rev=767633&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/test/resources-project-builder/profile-dependencies-multiple-profiles/pom.xml (added)
+++ maven/components/trunk/maven-project/src/test/resources-project-builder/profile-dependencies-multiple-profiles/pom.xml Wed Apr 22 19:39:18 2009
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.it0021</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Maven Integration Test :: it0021</name> 
+  <description>
+    Test pom-level profile inclusion (this one is activated by system property).
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-dependency-resolution</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>compile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>profile-1</id>
+      <activation>
+        <property>
+          <name>includeProfile</name>
+        </property>
+      </activation>
+      <dependencies>
+        <dependency>
+          <groupId>org.apache.maven.its.it0021</groupId>
+          <artifactId>a</artifactId>
+          <version>0.1</version>
+        </dependency>
+      </dependencies>
+    </profile>
+    <profile>
+      <id>profile-2</id>
+      <!-- to be activated explicitly on the CLI by its id -->
+      <dependencies>
+        <dependency>
+          <groupId>org.apache.maven.its.it0021</groupId>
+          <artifactId>b</artifactId>
+          <version>0.1</version>
+        </dependency>
+      </dependencies>
+    </profile>
+  </profiles>
+</project>