You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/06/08 05:27:46 UTC

svn commit: r189510 - /maven/components/trunk/maven-core-it /maven/components/trunk/maven-core-it/it0022 /maven/components/trunk/maven-core-it/it0022/src /maven/components/trunk/maven-core-it/it0022/src/main /maven/components/trunk/maven-core-it/it0022/src/main/java /maven/components/trunk/maven-core-it/it0022/src/main/java/org /maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache /maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/maven /maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/maven/it0022 /maven/components/trunk/maven-core-it/it0022/src/test /maven/components/trunk/maven-core-it/it0022/src/test/java /maven/components/trunk/maven-core-it/it0022/src/test/java/org /maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache /maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven /maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022 /maven/components/trunk/maven-core-it/it0023 /maven/components/trunk/maven-core-it/it0023/src /maven/components/trunk/maven-core-it/it0023/src/main /maven/components/trunk/maven-core-it/it0023/src/main/java /maven/components/trunk/maven-core-it/it0023/src/main/java/org /maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache /maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/maven /maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/maven/it0023 /maven/components/trunk/maven-core-it/it0023/src/test /maven/components/trunk/maven-core-it/it0023/src/test/java /maven/components/trunk/maven-core-it/it0023/src/test/java/org /maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache /maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven /maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023 /maven/components/trunk/maven-core/src/main/java/org/apache/maven /maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli /maven/components/trunk/maven-core/src/main/java/org/apache/maven/model /maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin /maven/components/trunk/maven-core/src/main/java/org/apache/maven/profiles /maven/components/trunk/maven-core/src/main/java/org/apache/maven/project /maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/inheritance /maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings /maven/components/trunk/maven-core/src/main/resources/META-INF/plexus /maven/components/trunk/maven-model /maven/components/trunk/maven-profile /maven/components/trunk/maven-project/src/main/java/org/apache/maven/artifact /maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile /maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation /maven/components/trunk/maven-project/src/main/java/org/apache/maven/project /maven/components/trunk/maven-project/src/main/resources/META-INF/plexus /maven/components/trunk/maven-settings

Author: jdcasey
Date: Tue Jun  7 20:27:43 2005
New Revision: 189510

URL: http://svn.apache.org/viewcvs?rev=189510&view=rev
Log:
Adding profiles.xml and settings.xml support for profiles, along with integration tests for each.

Added:
    maven/components/trunk/maven-core-it/it0022/
    maven/components/trunk/maven-core-it/it0022/expected-results.txt   (with props)
    maven/components/trunk/maven-core-it/it0022/goals.txt   (with props)
    maven/components/trunk/maven-core-it/it0022/pom.xml   (with props)
    maven/components/trunk/maven-core-it/it0022/profiles.xml   (with props)
    maven/components/trunk/maven-core-it/it0022/src/
    maven/components/trunk/maven-core-it/it0022/src/main/
    maven/components/trunk/maven-core-it/it0022/src/main/java/
    maven/components/trunk/maven-core-it/it0022/src/main/java/org/
    maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/
    maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/maven/
    maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/maven/it0022/
    maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/maven/it0022/Person.java   (with props)
    maven/components/trunk/maven-core-it/it0022/src/test/
    maven/components/trunk/maven-core-it/it0022/src/test/java/
    maven/components/trunk/maven-core-it/it0022/src/test/java/org/
    maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/
    maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/
    maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/
    maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeAddTest.java   (with props)
    maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeRemoveTest.java   (with props)
    maven/components/trunk/maven-core-it/it0022/system.properties   (with props)
    maven/components/trunk/maven-core-it/it0023/
    maven/components/trunk/maven-core-it/it0023/expected-results.txt   (with props)
    maven/components/trunk/maven-core-it/it0023/goals.txt   (with props)
    maven/components/trunk/maven-core-it/it0023/pom.xml   (with props)
    maven/components/trunk/maven-core-it/it0023/settings.xml   (with props)
    maven/components/trunk/maven-core-it/it0023/src/
    maven/components/trunk/maven-core-it/it0023/src/main/
    maven/components/trunk/maven-core-it/it0023/src/main/java/
    maven/components/trunk/maven-core-it/it0023/src/main/java/org/
    maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/
    maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/maven/
    maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/maven/it0023/
    maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/maven/it0023/Person.java   (with props)
    maven/components/trunk/maven-core-it/it0023/src/test/
    maven/components/trunk/maven-core-it/it0023/src/test/java/
    maven/components/trunk/maven-core-it/it0023/src/test/java/org/
    maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/
    maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/
    maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/
    maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeAddTest.java   (with props)
    maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeRemoveTest.java   (with props)
    maven/components/trunk/maven-core-it/it0023/system.properties   (with props)
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/ModelNormalizationUtils.java
      - copied, changed from r188792, maven/components/trunk/maven-core/src/main/java/org/apache/maven/profiles/ModelNormalizationUtils.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ExternalProfileInjector.java   (with props)
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/AlwaysOnActivation.java   (with props)
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/AlwaysOnProfileActivator.java   (with props)
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/DetectedProfileActivator.java   (with props)
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ProfileActivationUtils.java
      - copied, changed from r189464, maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ActivationConstants.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java   (with props)
Removed:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/profiles/ModelNormalizationUtils.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/inheritance/
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/artifact/
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ActivationConstants.java
Modified:
    maven/components/trunk/maven-core-it/README.txt
    maven/components/trunk/maven-core-it/integration-tests.txt
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java
    maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
    maven/components/trunk/maven-model/maven.mdo
    maven/components/trunk/maven-profile/profiles.mdo
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ExplicitListingProfileActivator.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/JdkPrefixProfileActivator.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/SystemPropertyProfileActivator.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
    maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml
    maven/components/trunk/maven-settings/settings.mdo

Modified: maven/components/trunk/maven-core-it/README.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/README.txt?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/README.txt (original)
+++ maven/components/trunk/maven-core-it/README.txt Tue Jun  7 20:27:43 2005
@@ -70,6 +70,12 @@
 it0021: Test pom-level profile inclusion (this one is activated by system
         property).
 
+it0022: Test profile inclusion from profiles.xml (this one is activated by system
+        property).
+
+it0023: Test profile inclusion from settings.xml (this one is activated by an id
+        in the activeProfiles section).
+
 -------------------------------------------------------------------------------
 
 - generated sources

Modified: maven/components/trunk/maven-core-it/integration-tests.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/integration-tests.txt?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/integration-tests.txt (original)
+++ maven/components/trunk/maven-core-it/integration-tests.txt Tue Jun  7 20:27:43 2005
@@ -20,3 +20,5 @@
 it0019
 it0020
 it0021
+it0022
+it0023

Added: maven/components/trunk/maven-core-it/it0022/expected-results.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/expected-results.txt?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0022/expected-results.txt (added)
+++ maven/components/trunk/maven-core-it/it0022/expected-results.txt Tue Jun  7 20:27:43 2005
@@ -0,0 +1 @@
+target/classes/org/apache/maven/it0022/test.txt

Propchange: maven/components/trunk/maven-core-it/it0022/expected-results.txt
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0022/goals.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/goals.txt?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0022/goals.txt (added)
+++ maven/components/trunk/maven-core-it/it0022/goals.txt Tue Jun  7 20:27:43 2005
@@ -0,0 +1 @@
+package
\ No newline at end of file

Propchange: maven/components/trunk/maven-core-it/it0022/goals.txt
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0022/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/pom.xml?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0022/pom.xml (added)
+++ maven/components/trunk/maven-core-it/it0022/pom.xml Tue Jun  7 20:27:43 2005
@@ -0,0 +1,26 @@
+<model>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven</groupId>
+  <artifactId>maven-it0022</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <test>${test}</test>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</model>
\ No newline at end of file

Propchange: maven/components/trunk/maven-core-it/it0022/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Propchange: maven/components/trunk/maven-core-it/it0022/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: maven/components/trunk/maven-core-it/it0022/profiles.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/profiles.xml?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0022/profiles.xml (added)
+++ maven/components/trunk/maven-core-it/it0022/profiles.xml Tue Jun  7 20:27:43 2005
@@ -0,0 +1,17 @@
+<profilesXml>
+  <profiles>
+    <profile>
+      <id>test-profile</id>
+      
+      <activation>
+        <property>
+          <name>includeProfile</name>
+        </property>
+      </activation>
+      
+      <properties>
+        <test>**/SomeAddTest*</test>
+      </properties>
+    </profile>
+  </profiles>
+</profilesXml>
\ No newline at end of file

Propchange: maven/components/trunk/maven-core-it/it0022/profiles.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Propchange: maven/components/trunk/maven-core-it/it0022/profiles.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/maven/it0022/Person.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/maven/it0022/Person.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/maven/it0022/Person.java (added)
+++ maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/maven/it0022/Person.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,16 @@
+package org.apache.maven.it0022;
+
+public class Person
+{
+    private String name;
+    
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+    
+    public String getName()
+    {
+        return name;
+    }
+}

Propchange: maven/components/trunk/maven-core-it/it0022/src/main/java/org/apache/maven/it0022/Person.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeAddTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeAddTest.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeAddTest.java (added)
+++ maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeAddTest.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,45 @@
+package org.apache.maven.it0022;
+
+import java.io.*;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class SomeAddTest
+    extends TestCase
+{
+    
+    public void testAdd() throws Exception
+    {
+        String className = Person.class.getName().replace( '.', '/' ) + ".class";
+        
+        URL resource = Person.class.getClassLoader().getResource( className );
+        
+        File personFile = new File( resource.getPath() ).getAbsoluteFile();
+        File dir = personFile.getParentFile();
+        
+        File testFile = new File( dir, "test.txt" );
+        
+        FileWriter writer = new FileWriter( testFile );
+        writer.write("this is a test");
+        writer.flush();
+        writer.close();
+    }
+
+}

Propchange: maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeAddTest.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeRemoveTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeRemoveTest.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeRemoveTest.java (added)
+++ maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeRemoveTest.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,45 @@
+package org.apache.maven.it0022;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class SomeRemoveTest
+    extends TestCase
+{
+    
+    public void testRemove()
+    {
+        String className = Person.class.getName().replace( '.', '/' ) + ".class";
+        
+        URL resource = Person.class.getClassLoader().getResource( className );
+        
+        File personFile = new File( resource.getPath() ).getAbsoluteFile();
+        File dir = personFile.getParentFile();
+        
+        File testFile = new File( dir, "test.txt" );
+        
+        if( testFile.exists() )
+        {
+            testFile.delete();
+        }
+    }
+
+}

Propchange: maven/components/trunk/maven-core-it/it0022/src/test/java/org/apache/maven/it0022/SomeRemoveTest.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0022/system.properties
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0022/system.properties?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0022/system.properties (added)
+++ maven/components/trunk/maven-core-it/it0022/system.properties Tue Jun  7 20:27:43 2005
@@ -0,0 +1 @@
+includeProfile=true

Propchange: maven/components/trunk/maven-core-it/it0022/system.properties
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0023/expected-results.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/expected-results.txt?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0023/expected-results.txt (added)
+++ maven/components/trunk/maven-core-it/it0023/expected-results.txt Tue Jun  7 20:27:43 2005
@@ -0,0 +1 @@
+target/classes/org/apache/maven/it0023/test.txt

Propchange: maven/components/trunk/maven-core-it/it0023/expected-results.txt
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0023/goals.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/goals.txt?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0023/goals.txt (added)
+++ maven/components/trunk/maven-core-it/it0023/goals.txt Tue Jun  7 20:27:43 2005
@@ -0,0 +1 @@
+package
\ No newline at end of file

Propchange: maven/components/trunk/maven-core-it/it0023/goals.txt
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0023/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/pom.xml?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0023/pom.xml (added)
+++ maven/components/trunk/maven-core-it/it0023/pom.xml Tue Jun  7 20:27:43 2005
@@ -0,0 +1,26 @@
+<model>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.</groupId>
+  <artifactId>maven-it0023</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <test>${test}</test>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</model>
\ No newline at end of file

Propchange: maven/components/trunk/maven-core-it/it0023/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Propchange: maven/components/trunk/maven-core-it/it0023/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: maven/components/trunk/maven-core-it/it0023/settings.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/settings.xml?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0023/settings.xml (added)
+++ maven/components/trunk/maven-core-it/it0023/settings.xml Tue Jun  7 20:27:43 2005
@@ -0,0 +1,21 @@
+<settings>
+  <activeProfiles>
+    <activeProfile>test-profile</activeProfile>
+  </activeProfiles>
+  
+  <profiles>
+    <profile>
+      <id>test-profile</id>
+      
+      <activation>
+        <property>
+          <name>includeProfile</name>
+        </property>
+      </activation>
+      
+      <properties>
+        <test>**/SomeAddTest*</test>
+      </properties>
+    </profile>
+  </profiles>
+</settings>
\ No newline at end of file

Propchange: maven/components/trunk/maven-core-it/it0023/settings.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Propchange: maven/components/trunk/maven-core-it/it0023/settings.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/maven/it0023/Person.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/maven/it0023/Person.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/maven/it0023/Person.java (added)
+++ maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/maven/it0023/Person.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,16 @@
+package org.apache.maven.it0023;
+
+public class Person
+{
+    private String name;
+    
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+    
+    public String getName()
+    {
+        return name;
+    }
+}

Propchange: maven/components/trunk/maven-core-it/it0023/src/main/java/org/apache/maven/it0023/Person.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeAddTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeAddTest.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeAddTest.java (added)
+++ maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeAddTest.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,45 @@
+package org.apache.maven.it0023;
+
+import java.io.*;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class SomeAddTest
+    extends TestCase
+{
+    
+    public void testAdd() throws Exception
+    {
+        String className = Person.class.getName().replace( '.', '/' ) + ".class";
+        
+        URL resource = Person.class.getClassLoader().getResource( className );
+        
+        File personFile = new File( resource.getPath() ).getAbsoluteFile();
+        File dir = personFile.getParentFile();
+        
+        File testFile = new File( dir, "test.txt" );
+        
+        FileWriter writer = new FileWriter( testFile );
+        writer.write("this is a test");
+        writer.flush();
+        writer.close();
+    }
+
+}

Propchange: maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeAddTest.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeRemoveTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeRemoveTest.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeRemoveTest.java (added)
+++ maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeRemoveTest.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,45 @@
+package org.apache.maven.it0023;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class SomeRemoveTest
+    extends TestCase
+{
+    
+    public void testRemove()
+    {
+        String className = Person.class.getName().replace( '.', '/' ) + ".class";
+        
+        URL resource = Person.class.getClassLoader().getResource( className );
+        
+        File personFile = new File( resource.getPath() ).getAbsoluteFile();
+        File dir = personFile.getParentFile();
+        
+        File testFile = new File( dir, "test.txt" );
+        
+        if( testFile.exists() )
+        {
+            testFile.delete();
+        }
+    }
+
+}

Propchange: maven/components/trunk/maven-core-it/it0023/src/test/java/org/apache/maven/it0023/SomeRemoveTest.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-core-it/it0023/system.properties
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0023/system.properties?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0023/system.properties (added)
+++ maven/components/trunk/maven-core-it/it0023/system.properties Tue Jun  7 20:27:43 2005
@@ -0,0 +1 @@
+org.apache.maven.SettingsXmlFile=settings.xml

Propchange: maven/components/trunk/maven-core-it/it0023/system.properties
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Tue Jun  7 20:27:43 2005
@@ -24,9 +24,15 @@
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.lifecycle.LifecycleExecutionException;
 import org.apache.maven.lifecycle.LifecycleExecutor;
+import org.apache.maven.model.ModelNormalizationUtils;
+import org.apache.maven.model.Profile;
 import org.apache.maven.monitor.event.EventDispatcher;
 import org.apache.maven.monitor.event.MavenEvents;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.profile.AlwaysOnActivation;
+import org.apache.maven.profiles.MavenProfilesBuilder;
+import org.apache.maven.profiles.ProfilesRoot;
+import org.apache.maven.project.ExternalProfileInjector;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
@@ -45,6 +51,7 @@
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
 import org.codehaus.plexus.util.dag.CycleDetectedException;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
 import java.io.IOException;
@@ -74,6 +81,10 @@
     protected PlexusContainer container;
 
     protected Map errorDiagnosers;
+    
+    protected MavenProfilesBuilder profilesBuilder;
+    
+    protected ExternalProfileInjector externalProfileInjector;
 
     // ----------------------------------------------------------------------
     // Project execution
@@ -105,7 +116,7 @@
 
         try
         {
-            projects = collectProjects( request.getFiles(), request.getLocalRepository(), request.isRecursive() );
+            projects = collectProjects( request.getFiles(), request.getLocalRepository(), request.isRecursive(), request.getSettings() );
 
             projects = ProjectSorter.getSortedProjects( projects );
 
@@ -188,7 +199,7 @@
         }
     }
 
-    private List collectProjects( List files, ArtifactRepository localRepository, boolean recursive )
+    private List collectProjects( List files, ArtifactRepository localRepository, boolean recursive, Settings settings )
         throws ProjectBuildingException, ReactorException, IOException, ArtifactResolutionException
     {
         List projects = new ArrayList( files.size() );
@@ -197,7 +208,7 @@
         {
             File file = (File) iterator.next();
 
-            MavenProject project = getProject( file, localRepository );
+            MavenProject project = getProject( file, localRepository, settings );
 
             if ( project.getModules() != null && !project.getModules().isEmpty() && recursive )
             {
@@ -214,7 +225,7 @@
                     moduleFiles.add( new File( basedir, name + "/pom.xml" ) );
                 }
 
-                List collectedProjects = collectProjects( moduleFiles, localRepository, recursive );
+                List collectedProjects = collectProjects( moduleFiles, localRepository, recursive, settings );
                 projects.addAll( collectedProjects );
                 project.setCollectedProjects( collectedProjects );
             }
@@ -292,7 +303,7 @@
         return response;
     }
 
-    public MavenProject getProject( File pom, ArtifactRepository localRepository )
+    public MavenProject getProject( File pom, ArtifactRepository localRepository, Settings settings )
         throws ProjectBuildingException, ArtifactResolutionException
     {
         if ( pom.exists() )
@@ -303,7 +314,62 @@
             }
         }
 
-        return projectBuilder.build( pom, localRepository );
+        MavenProject project = projectBuilder.build( pom, localRepository );
+        
+        // TODO: apply profiles.xml and settings.xml Profiles here.
+        List settingsProfiles = settings.getProfiles();
+        
+        if(settingsProfiles != null && !settingsProfiles.isEmpty())
+        {
+            List profiles = new ArrayList();
+            
+            List settingsActiveProfileIds = settings.getActiveProfiles();
+            
+            for ( Iterator it = settings.getProfiles().iterator(); it.hasNext(); )
+            {
+                org.apache.maven.settings.Profile rawProfile = (org.apache.maven.settings.Profile) it.next();
+                
+                Profile profile = ModelNormalizationUtils.convertFromSettingsProfile( rawProfile );
+                
+                if( settingsActiveProfileIds.contains( rawProfile.getId() ) )
+                {
+                    profile.setActivation( new AlwaysOnActivation() );
+                }
+                
+                profiles.add( profile );
+            }
+            
+            externalProfileInjector.injectExternalProfiles( project, profiles );
+        }
+        
+        try
+        {
+            ProfilesRoot root = profilesBuilder.buildProfiles( pom.getParentFile() );
+            
+            if( root != null )
+            {
+                List profiles = new ArrayList();
+                
+                for ( Iterator it = root.getProfiles().iterator(); it.hasNext(); )
+                {
+                    org.apache.maven.profiles.Profile rawProfile = (org.apache.maven.profiles.Profile) it.next();
+                    
+                    profiles.add( ModelNormalizationUtils.convertFromProfileXmlProfile( rawProfile ) );
+                }
+                
+                externalProfileInjector.injectExternalProfiles( project, profiles );
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new ProjectBuildingException( "Cannot read profiles.xml resource for pom: " + pom, e );
+        }
+        catch ( XmlPullParserException e )
+        {
+            throw new ProjectBuildingException( "Cannot parse profiles.xml resource for pom: " + pom, e );
+        }
+        
+        return project;
     }
 
     // ----------------------------------------------------------------------

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java Tue Jun  7 20:27:43 2005
@@ -37,6 +37,7 @@
 import org.apache.maven.monitor.event.DefaultEventMonitor;
 import org.apache.maven.monitor.event.EventDispatcher;
 import org.apache.maven.plugin.Mojo;
+import org.apache.maven.profile.activation.ProfileActivationUtils;
 import org.apache.maven.reactor.ReactorException;
 import org.apache.maven.settings.MavenSettingsBuilder;
 import org.apache.maven.settings.Settings;
@@ -115,6 +116,11 @@
         // ----------------------------------------------------------------------
 
         initializeSystemProperties( commandLine );
+        
+        if( commandLine.hasOption( CLIManager.ACTIVATE_PROFILES ) )
+        {
+            System.setProperty(ProfileActivationUtils.ACTIVE_PROFILE_IDS, commandLine.getOptionValue( CLIManager.ACTIVATE_PROFILES ) );
+        }
 
         boolean debug = commandLine.hasOption( CLIManager.DEBUG );
 
@@ -479,6 +485,8 @@
         public static final char NON_RECURSIVE = 'N';
 
         public static final char UPDATE_SNAPSHOTS = 'U';
+        
+        public static final char ACTIVATE_PROFILES = 'P';
 
         public CLIManager()
         {
@@ -503,6 +511,8 @@
                 "Do not recurse into sub-projects" ).create( NON_RECURSIVE ) );
             options.addOption( OptionBuilder.withLongOpt( "update-snapshots" ).withDescription(
                 "Update all snapshots regardless of repository policies" ).create( UPDATE_SNAPSHOTS ) );
+            options.addOption( OptionBuilder.withLongOpt( "activate-profiles" ).withDescription(
+                "Comma-delimited list of profiles to activate").hasArg().create( ACTIVATE_PROFILES ) );
         }
 
         public CommandLine parse( String[] args )

Copied: maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/ModelNormalizationUtils.java (from r188792, maven/components/trunk/maven-core/src/main/java/org/apache/maven/profiles/ModelNormalizationUtils.java)
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/ModelNormalizationUtils.java?p2=maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/ModelNormalizationUtils.java&p1=maven/components/trunk/maven-core/src/main/java/org/apache/maven/profiles/ModelNormalizationUtils.java&r1=188792&r2=189510&rev=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/profiles/ModelNormalizationUtils.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/model/ModelNormalizationUtils.java Tue Jun  7 20:27:43 2005
@@ -1,7 +1,10 @@
-package org.apache.maven.profiles;
+package org.apache.maven.model;
 
 import org.apache.maven.model.Profile;
 import org.apache.maven.model.Repository;
+import org.apache.maven.model.Activation;
+import org.apache.maven.model.ActivationProperty;
+import org.apache.maven.profile.AlwaysOnActivation;
 
 import java.util.Iterator;
 import java.util.List;
@@ -28,63 +31,117 @@
     private ModelNormalizationUtils()
     {
     }
-    
+
     public static Profile convertFromSettingsProfile( org.apache.maven.settings.Profile settingsProfile )
     {
         Profile profile = new Profile();
-        profile.setConfiguration( settingsProfile.getConfiguration() );
-        
+
+        org.apache.maven.settings.Activation settingsActivation = settingsProfile.getActivation();
+
+        if ( settingsActivation != null )
+        {
+            Activation activation = new Activation();
+
+            activation.setJdk( settingsActivation.getJdk() );
+
+            org.apache.maven.settings.ActivationProperty settingsProp = settingsActivation.getProperty();
+
+            if ( settingsProp != null )
+            {
+                ActivationProperty prop = new ActivationProperty();
+
+                prop.setName( settingsProp.getName() );
+                prop.setValue( settingsProp.getValue() );
+
+                activation.setProperty( prop );
+            }
+        }
+
+        profile.setProperties( settingsProfile.getProperties() );
+
         List repos = settingsProfile.getRepositories();
-        if( repos != null )
+        if ( repos != null )
         {
             for ( Iterator it = repos.iterator(); it.hasNext(); )
             {
-                 profile.addRepository( convertFromSettingsRepository( (org.apache.maven.settings.Repository) it.next() ) );
+                profile
+                    .addRepository( convertFromSettingsRepository( (org.apache.maven.settings.Repository) it.next() ) );
             }
         }
-        
+
         List pluginRepos = settingsProfile.getPluginRepositories();
-        if( pluginRepos != null )
+        if ( pluginRepos != null )
         {
             for ( Iterator it = pluginRepos.iterator(); it.hasNext(); )
             {
-                 profile.addPluginRepository( convertFromSettingsRepository( (org.apache.maven.settings.Repository) it.next() ) );
+                profile.addPluginRepository( convertFromSettingsRepository( (org.apache.maven.settings.Repository) it
+                    .next() ) );
             }
         }
-        
+
         return profile;
     }
-    
+
     public static Profile convertFromProfileXmlProfile( org.apache.maven.profiles.Profile profileXmlProfile )
     {
         Profile profile = new Profile();
-        profile.setConfiguration( profileXmlProfile.getConfiguration() );
         
+        org.apache.maven.profiles.Activation profileActivation = profileXmlProfile.getActivation();
+
+        if ( profileActivation != null )
+        {
+            Activation activation = new Activation();
+
+            activation.setJdk( profileActivation.getJdk() );
+
+            org.apache.maven.profiles.ActivationProperty profileProp = profileActivation.getProperty();
+
+            if ( profileProp != null )
+            {
+                ActivationProperty prop = new ActivationProperty();
+
+                prop.setName( profileProp.getName() );
+                prop.setValue( profileProp.getValue() );
+
+                activation.setProperty( prop );
+            }
+            
+            profile.setActivation( activation );
+        }
+        else
+        {
+            profile.setActivation( new AlwaysOnActivation() );
+        }
+        
+        profile.setProperties( profileXmlProfile.getProperties() );
+
         List repos = profileXmlProfile.getRepositories();
-        if( repos != null )
+        if ( repos != null )
         {
             for ( Iterator it = repos.iterator(); it.hasNext(); )
             {
-                 profile.addRepository( convertFromSettingsRepository( (org.apache.maven.settings.Repository) it.next() ) );
+                profile
+                    .addRepository( convertFromSettingsRepository( (org.apache.maven.settings.Repository) it.next() ) );
             }
         }
-        
+
         List pluginRepos = profileXmlProfile.getPluginRepositories();
-        if( pluginRepos != null )
+        if ( pluginRepos != null )
         {
             for ( Iterator it = pluginRepos.iterator(); it.hasNext(); )
             {
-                 profile.addPluginRepository( convertFromSettingsRepository( (org.apache.maven.settings.Repository) it.next() ) );
+                profile.addPluginRepository( convertFromSettingsRepository( (org.apache.maven.settings.Repository) it
+                    .next() ) );
             }
         }
-        
+
         return profile;
     }
-    
+
     private static Repository convertFromSettingsRepository( org.apache.maven.settings.Repository settingsRepo )
     {
         Repository repo = new Repository();
-        
+
         repo.setId( settingsRepo.getId() );
         repo.setLayout( settingsRepo.getLayout() );
         repo.setName( settingsRepo.getName() );

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Tue Jun  7 20:27:43 2005
@@ -405,7 +405,7 @@
 
             PlexusConfiguration mergedConfiguration = mergeConfiguration( pomConfiguration,
                                                                           mojoDescriptor.getMojoConfiguration() );
-
+            
             // TODO: plexus
 //            PlexusConfiguration mergedConfiguration = mergeConfiguration( pomConfiguration,
 //                                                                          mojoDescriptor.getConfiguration() );
@@ -488,7 +488,9 @@
                     if ( value != null )
                     {
                         expression = value.getValue( null );
+                        
                         fieldValue = expressionEvaluator.evaluate( expression );
+                        
                         if ( fieldValue == null )
                         {
                             fieldValue = value.getAttribute( "default-value", null );

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java Tue Jun  7 20:27:43 2005
@@ -132,12 +132,23 @@
         }
         else
         {
-            // We will attempt to get nab a system property as a way to specify a
-            // parameter to a plugins. My particular case here is allowing the surefire
-            // plugin to run a single test so I want to specify that class on the cli
-            // as a parameter.
+            // Check properties that have been injected via profiles before we default over to 
+            // system properties.
+            
+            if( context.getProject().getProfileConfiguration() != null )
+            {
+                value = context.getProject().getProfileConfiguration().getProperty( expression );
+            }
+            
+            if( value == null )
+            {
+                // We will attempt to get nab a system property as a way to specify a
+                // parameter to a plugins. My particular case here is allowing the surefire
+                // plugin to run a single test so I want to specify that class on the cli
+                // as a parameter.
 
-            value = System.getProperty( expression );
+                value = System.getProperty( expression );
+            }
         }
 
         if ( value instanceof String )

Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ExternalProfileInjector.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ExternalProfileInjector.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ExternalProfileInjector.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ExternalProfileInjector.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,137 @@
+package org.apache.maven.project;
+
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Profile;
+import org.apache.maven.profile.activation.ProfileActivationCalculator;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.ContextException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class ExternalProfileInjector
+    extends AbstractLogEnabled
+    implements Contextualizable
+{
+
+    public static final String ROLE = ExternalProfileInjector.class.getName();
+
+    private ArtifactRepositoryFactory artifactRepositoryFactory;
+
+    private ProfileActivationCalculator profileActivationCalculator;
+
+    private PlexusContainer container;
+
+    public void injectExternalProfiles( MavenProject project, List profiles )
+        throws ProjectBuildingException
+    {
+        List activeProfiles = profileActivationCalculator.calculateActiveProfiles( profiles );
+        
+        Model model = project.getModel();
+
+        for ( Iterator it = activeProfiles.iterator(); it.hasNext(); )
+        {
+            Profile profile = (Profile) it.next();
+            
+            mergeRepositories( project, model, profile );
+            
+            mergePluginRepositories( project, model, profile );
+            
+            Properties props = profile.getProperties();
+            
+            if( props != null )
+            {
+                project.addProfileConfiguration( props );
+            }
+        }
+    }
+
+    private void mergePluginRepositories( MavenProject project, Model model, Profile profile ) throws ProjectBuildingException
+    {
+        List repos = profile.getPluginRepositories();
+        if( repos != null && !repos.isEmpty() )
+        {
+            List modelRepos = model.getPluginRepositories();
+            if( modelRepos == null )
+            {
+                modelRepos = new ArrayList();
+                
+                model.setPluginRepositories( modelRepos );
+            }
+            
+            modelRepos.addAll( repos );
+            
+            List artifactRepos = ProjectUtils.buildArtifactRepositories( repos, artifactRepositoryFactory, container );
+            
+            List projectRepos = project.getPluginArtifactRepositories();
+            if( projectRepos == null )
+            {
+                projectRepos = new ArrayList();
+                
+                project.setPluginArtifactRepositories( projectRepos );
+            }
+            
+            projectRepos.addAll( artifactRepos );
+        }
+    }
+
+    private void mergeRepositories( MavenProject project, Model model, Profile profile )
+        throws ProjectBuildingException
+    {
+        List repos = profile.getRepositories();
+        if( repos != null && !repos.isEmpty() )
+        {
+            List modelRepos = model.getRepositories();
+            if( modelRepos == null )
+            {
+                modelRepos = new ArrayList();
+                
+                model.setRepositories( modelRepos );
+            }
+            
+            modelRepos.addAll( repos );
+            
+            List artifactRepos = ProjectUtils.buildArtifactRepositories( repos, artifactRepositoryFactory, container );
+            
+            List projectRepos = project.getRemoteArtifactRepositories();
+            if( projectRepos == null )
+            {
+                projectRepos = new ArrayList();
+                
+                project.setRemoteArtifactRepositories( projectRepos );
+            }
+            
+            projectRepos.addAll( artifactRepos );
+        }
+    }
+
+    public void contextualize( Context context )
+        throws ContextException
+    {
+        this.container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+    }
+
+}

Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ExternalProfileInjector.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java Tue Jun  7 20:27:43 2005
@@ -21,6 +21,7 @@
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
@@ -115,17 +116,19 @@
 
     private File getSettingsFile()
     {
-        String path = settingsPath;
-
-        // TODO: This replacing shouldn't be necessary as user.home should be in the
-        // context of the container and thus the value would be interpolated by Plexus
-        String userHome = System.getProperty( "user.home" );
-        userHome = userHome.replaceAll( "\\\\", "/" );
-
-        path = path.replaceAll( "\\$\\{user.home\\}", userHome );
-        path = path.replaceAll( "\\\\", "/" );
-        path = path.replaceAll( "//", "/" );
+        String path = System.getProperty( MavenSettingsBuilder.ALT_SETTINGS_XML_LOCATION );
+        
+        if( StringUtils.isEmpty( path ) )
+        {
+            // TODO: This replacing shouldn't be necessary as user.home should be in the
+            // context of the container and thus the value would be interpolated by Plexus
+            String userHome = System.getProperty( "user.home" );
 
-        return new File( path );
+            return new File( userHome, settingsPath ).getAbsoluteFile();
+        }
+        else
+        {
+            return new File( path ).getAbsoluteFile();
+        }
     }
 }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java Tue Jun  7 20:27:43 2005
@@ -28,6 +28,8 @@
 public interface MavenSettingsBuilder
 {
     String ROLE = MavenSettingsBuilder.class.getName();
+    
+    String ALT_SETTINGS_XML_LOCATION = "org.apache.maven.SettingsXmlFile";
 
     Settings buildSettings()
         throws IOException, XmlPullParserException;

Modified: maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml Tue Jun  7 20:27:43 2005
@@ -19,6 +19,38 @@
           <role>org.apache.maven.usability.ErrorDiagnoser</role>
           <field-name>errorDiagnosers</field-name>
         </requirement>
+        <requirement>
+          <role>org.apache.maven.profiles.MavenProfilesBuilder</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.project.ExternalProfileInjector</role>
+        </requirement>
+      </requirements>
+    </component>
+    <!--
+     |
+     |
+     |
+     -->
+    <component>
+      <role>org.apache.maven.profiles.MavenProfilesBuilder</role>
+      <implementation>org.apache.maven.profiles.DefaultMavenProfilesBuilder</implementation>
+    </component>
+    <!--
+     |
+     |
+     |
+     -->
+    <component>
+      <role>org.apache.maven.project.ExternalProfileInjector</role>
+      <implementation>org.apache.maven.project.ExternalProfileInjector</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.profile.activation.ProfileActivationCalculator</role>
+        </requirement>
       </requirements>
     </component>
     <!--
@@ -152,7 +184,7 @@
       <role>org.apache.maven.settings.MavenSettingsBuilder</role>
       <implementation>org.apache.maven.settings.DefaultMavenSettingsBuilder</implementation>
       <configuration>
-        <settingsPath>${user.home}/.m2/settings.xml</settingsPath>
+        <settingsPath>.m2/settings.xml</settingsPath>
       </configuration>
     </component>
   </components>

Modified: maven/components/trunk/maven-model/maven.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-model/maven.mdo?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-model/maven.mdo (original)
+++ maven/components/trunk/maven-model/maven.mdo Tue Jun  7 20:27:43 2005
@@ -2308,16 +2308,16 @@
           <version>4.0.0</version>
           <code><![CDATA[
     // We don't want this to be parseable...it's sort of 'hidden'
-    private Object configuration;
+    private Properties properties;
     
-    public void setConfiguration( Object configuration )
+    public void setProperties( Properties properties )
     {
-        this.configuration = configuration;
+        this.properties = properties;
     }
     
-    public Object getConfiguration()
+    public Properties getProperties()
     {
-        return configuration;
+        return properties;
     }
           ]]></code>
         </codeSegment>

Modified: maven/components/trunk/maven-profile/profiles.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-profile/profiles.mdo?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-profile/profiles.mdo (original)
+++ maven/components/trunk/maven-profile/profiles.mdo Tue Jun  7 20:27:43 2005
@@ -69,10 +69,14 @@
           </association>
         </field>
         <field>
-          <name>configuration</name>
-          <description>Extended configuration specific to this notifier goes 
+          <name>properties</name>
+          <description>Extended configuration specific to this profile goes 
             here.</description>
-          <type>DOM</type>
+          <type>Properties</type>
+          <association xml.mapStyle="inline">
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
         </field>
         <field>
           <name>repositories</name>

Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/AlwaysOnActivation.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/AlwaysOnActivation.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/AlwaysOnActivation.java (added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/AlwaysOnActivation.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,25 @@
+package org.apache.maven.profile;
+
+import org.apache.maven.model.Activation;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class AlwaysOnActivation
+    extends Activation
+{
+
+}

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/AlwaysOnActivation.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/AlwaysOnProfileActivator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/AlwaysOnProfileActivator.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/AlwaysOnProfileActivator.java (added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/AlwaysOnProfileActivator.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,36 @@
+package org.apache.maven.profile.activation;
+
+import org.apache.maven.model.Profile;
+import org.apache.maven.profile.AlwaysOnActivation;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class AlwaysOnProfileActivator
+    implements ProfileActivator
+{
+
+    public boolean canDetermineActivation( Profile profile )
+    {
+        return profile.getActivation() != null && profile.getActivation() instanceof AlwaysOnActivation;
+    }
+
+    public boolean isActive( Profile profile )
+    {
+        return true;
+    }
+
+}

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/AlwaysOnProfileActivator.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/DetectedProfileActivator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/DetectedProfileActivator.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/DetectedProfileActivator.java (added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/DetectedProfileActivator.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,32 @@
+package org.apache.maven.profile.activation;
+
+import org.apache.maven.model.Profile;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public abstract class DetectedProfileActivator
+    implements ProfileActivator
+{
+
+    public boolean canDetermineActivation( Profile profile )
+    {
+        return !ProfileActivationUtils.profilesWereExplicitlyGiven() && canDetectActivation( profile );
+    }
+    
+    protected abstract boolean canDetectActivation( Profile profile );
+
+}

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/DetectedProfileActivator.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ExplicitListingProfileActivator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ExplicitListingProfileActivator.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ExplicitListingProfileActivator.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ExplicitListingProfileActivator.java Tue Jun  7 20:27:43 2005
@@ -2,8 +2,6 @@
 
 import org.apache.maven.model.Profile;
 
-import java.util.StringTokenizer;
-
 /*
  * Copyright 2001-2005 The Apache Software Foundation.
  *
@@ -26,31 +24,12 @@
 
     public boolean canDetermineActivation( Profile profile )
     {
-        return profile.getActivation() == null;
+        return ProfileActivationUtils.profilesWereExplicitlyGiven();
     }
 
     public boolean isActive( Profile profile )
     {
-        String activeProfiles = System.getProperty( ActivationConstants.ACTIVE_PROFILE_IDS );
-
-        if ( activeProfiles != null )
-        {
-            String profileId = profile.getId();
-
-            StringTokenizer profileTokens = new StringTokenizer( activeProfiles, "," );
-
-            while ( profileTokens.hasMoreTokens() )
-            {
-                String currentToken = profileTokens.nextToken().trim();
-
-                if ( profileId.equals( currentToken ) )
-                {
-                    return true;
-                }
-            }
-        }
-
-        return false;
+        return ProfileActivationUtils.getExplicitProfileList().contains( profile.getId() );
     }
 
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/JdkPrefixProfileActivator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/JdkPrefixProfileActivator.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/JdkPrefixProfileActivator.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/JdkPrefixProfileActivator.java Tue Jun  7 20:27:43 2005
@@ -21,7 +21,7 @@
  */
 
 public class JdkPrefixProfileActivator
-    implements ProfileActivator
+    extends DetectedProfileActivator
 {
 
     private static final String JDK_VERSION = System.getProperty( "java.version" );
@@ -36,7 +36,7 @@
         return JDK_VERSION.startsWith( jdk );
     }
 
-    public boolean canDetermineActivation( Profile profile )
+    protected boolean canDetectActivation( Profile profile )
     {
         return profile.getActivation() != null && StringUtils.isNotEmpty( profile.getActivation().getJdk() );
     }

Copied: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ProfileActivationUtils.java (from r189464, maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ActivationConstants.java)
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ProfileActivationUtils.java?p2=maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ProfileActivationUtils.java&p1=maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ActivationConstants.java&r1=189464&r2=189510&rev=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ActivationConstants.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/ProfileActivationUtils.java Tue Jun  7 20:27:43 2005
@@ -1,5 +1,11 @@
 package org.apache.maven.profile.activation;
 
+import org.codehaus.plexus.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
 /*
  * Copyright 2001-2005 The Apache Software Foundation.
  *
@@ -16,13 +22,47 @@
  * limitations under the License.
  */
 
-public final class ActivationConstants
+public final class ProfileActivationUtils
 {
 
-    public static final String ACTIVE_PROFILE_IDS = "org.apache.maven.ActiveProfileIds";
+    public static final String ACTIVE_PROFILE_IDS = "org.apache.maven.ActiveProfiles";
+    
+    private static List profileList;
 
-    private ActivationConstants()
+    private ProfileActivationUtils()
+    {
+    }
+    
+    public static boolean profilesWereExplicitlyGiven()
+    {
+        return StringUtils.isNotEmpty( System.getProperty( ACTIVE_PROFILE_IDS ) );
+    }
+    
+    public static List getExplicitProfileList()
     {
+        if(!profilesWereExplicitlyGiven())
+        {
+            return null;
+        }
+        
+        if( profileList == null )
+        {
+            profileList = new ArrayList();
+            
+            StringTokenizer profileTokens = new StringTokenizer( System.getProperty( ACTIVE_PROFILE_IDS ), "," );
+            
+            while( profileTokens.hasMoreTokens() )
+            {
+                String token = profileTokens.nextToken().trim();
+                
+                if( StringUtils.isNotEmpty( token ) )
+                {
+                    profileList.add( token );
+                }
+            }
+        }
+        
+        return profileList;
     }
 
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/SystemPropertyProfileActivator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/SystemPropertyProfileActivator.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/SystemPropertyProfileActivator.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profile/activation/SystemPropertyProfileActivator.java Tue Jun  7 20:27:43 2005
@@ -22,10 +22,10 @@
  */
 
 public class SystemPropertyProfileActivator
-    implements ProfileActivator
+    extends DetectedProfileActivator
 {
 
-    public boolean canDetermineActivation( Profile profile )
+    protected boolean canDetectActivation( Profile profile )
     {
         return profile.getActivation() != null && profile.getActivation().getProperty() != null;
     }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Tue Jun  7 20:27:43 2005
@@ -21,7 +21,6 @@
 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
@@ -32,9 +31,9 @@
 import org.apache.maven.model.Parent;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.Profile;
-import org.apache.maven.model.Repository;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.profile.activation.ProfileActivationCalculator;
+import org.apache.maven.project.artifact.MavenMetadataSource;
 import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
 import org.apache.maven.project.injection.ModelDefaultsInjector;
 import org.apache.maven.project.interpolation.ModelInterpolationException;
@@ -42,10 +41,8 @@
 import org.apache.maven.project.path.PathTranslator;
 import org.apache.maven.project.validation.ModelValidationResult;
 import org.apache.maven.project.validation.ModelValidator;
-import org.apache.maven.project.artifact.MavenMetadataSource;
 import org.codehaus.plexus.PlexusConstants;
 import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import org.codehaus.plexus.context.Context;
 import org.codehaus.plexus.context.ContextException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -61,7 +58,6 @@
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -223,7 +219,7 @@
 
         LinkedList lineage = new LinkedList();
 
-        List aggregatedRemoteWagonRepositories = buildArtifactRepositories( superModel.getRepositories() );
+        List aggregatedRemoteWagonRepositories = ProjectUtils.buildArtifactRepositories( superModel.getRepositories(), artifactRepositoryFactory, container );
 
         MavenProject project = assembleLineage( model, lineage, aggregatedRemoteWagonRepositories, localRepository );
 
@@ -285,12 +281,12 @@
 
         project = new MavenProject( model );
 
-        project.setPluginArtifactRepositories( buildArtifactRepositories( model.getPluginRepositories() ) );
+        project.setPluginArtifactRepositories( ProjectUtils.buildArtifactRepositories( model.getPluginRepositories(), artifactRepositoryFactory, container ) );
 
         DistributionManagement dm = model.getDistributionManagement();
         if ( dm != null )
         {
-            project.setDistributionManagementArtifactRepository( buildArtifactRepository( dm.getRepository() ) );
+            project.setDistributionManagementArtifactRepository( ProjectUtils.buildArtifactRepository( dm.getRepository(), artifactRepositoryFactory, container ) );
         }
 
         project.setParent( parentProject );
@@ -323,7 +319,7 @@
                                           ArtifactRepository localRepository )
         throws ProjectBuildingException, ArtifactResolutionException
     {
-        aggregatedRemoteWagonRepositories.addAll( buildArtifactRepositories( model.getRepositories() ) );
+        aggregatedRemoteWagonRepositories.addAll( ProjectUtils.buildArtifactRepositories( model.getRepositories(), artifactRepositoryFactory, container ) );
 
         MavenProject project = new MavenProject( model );
 
@@ -370,62 +366,6 @@
         return project;
     }
 
-    private List buildArtifactRepositories( List repositories )
-        throws ProjectBuildingException
-    {
-
-        List repos = new ArrayList();
-
-        for ( Iterator i = repositories.iterator(); i.hasNext(); )
-        {
-            Repository mavenRepo = (Repository) i.next();
-
-            ArtifactRepository artifactRepo = buildArtifactRepository( mavenRepo );
-
-            if ( !repos.contains( artifactRepo ) )
-            {
-                repos.add( artifactRepo );
-            }
-        }
-        return repos;
-    }
-
-    private ArtifactRepositoryLayout getRepositoryLayout( Repository mavenRepo )
-        throws ProjectBuildingException
-    {
-        String layout = mavenRepo.getLayout();
-
-        ArtifactRepositoryLayout repositoryLayout = null;
-        try
-        {
-            repositoryLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, layout );
-        }
-        catch ( ComponentLookupException e )
-        {
-            throw new ProjectBuildingException( "Cannot find layout implementation corresponding to: \'" + layout +
-                                                "\' for remote repository with id: \'" + mavenRepo.getId() + "\'.", e );
-        }
-        return repositoryLayout;
-    }
-
-    private ArtifactRepository buildArtifactRepository( Repository repo )
-        throws ProjectBuildingException
-    {
-        if ( repo != null )
-        {
-            String id = repo.getId();
-            String url = repo.getUrl();
-            String snapshotPolicy = repo.getSnapshotPolicy();
-            // TODO: make this a map inside the factory instead, so no lookup needed
-            ArtifactRepositoryLayout layout = getRepositoryLayout( repo );
-            return artifactRepositoryFactory.createArtifactRepository( id, url, layout, snapshotPolicy );
-        }
-        else
-        {
-            return null;
-        }
-    }
-
     private Model readModel( File file )
         throws ProjectBuildingException
     {
@@ -541,7 +481,7 @@
         {
             project.setFile( new File( ".", "pom.xml" ) );
 
-            List remoteRepositories = buildArtifactRepositories( superModel.getRepositories() );
+            List remoteRepositories = ProjectUtils.buildArtifactRepositories( superModel.getRepositories(), artifactRepositoryFactory, container );
 
             project = processProjectLogic( "<Super-POM>", project, remoteRepositories );
 

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java Tue Jun  7 20:27:43 2005
@@ -48,6 +48,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 
 /**
@@ -78,6 +79,8 @@
     private Set pluginArtifacts;
 
     private List remoteArtifactRepositories;
+    
+    private Properties profileConfiguration;
 
     private List collectedProjects = Collections.EMPTY_LIST;
 
@@ -884,6 +887,16 @@
     public List getPluginRepositories()
     {
         return model.getPluginRepositories();
+    }
+
+    public Properties getProfileConfiguration()
+    {
+        return profileConfiguration;
+    }
+
+    public void addProfileConfiguration( Properties profileConfiguration )
+    {
+        this.profileConfiguration = profileConfiguration;
     }
 
 }

Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java?rev=189510&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java (added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java Tue Jun  7 20:27:43 2005
@@ -0,0 +1,97 @@
+package org.apache.maven.project;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.model.Repository;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public final class ProjectUtils
+{
+
+    private ProjectUtils()
+    {
+    }
+
+    public static List buildArtifactRepositories( List repositories,
+                                                 ArtifactRepositoryFactory artifactRepositoryFactory,
+                                                 PlexusContainer container )
+        throws ProjectBuildingException
+    {
+
+        List repos = new ArrayList();
+
+        for ( Iterator i = repositories.iterator(); i.hasNext(); )
+        {
+            Repository mavenRepo = (Repository) i.next();
+
+            ArtifactRepository artifactRepo = buildArtifactRepository( mavenRepo, artifactRepositoryFactory, container );
+
+            if ( !repos.contains( artifactRepo ) )
+            {
+                repos.add( artifactRepo );
+            }
+        }
+        return repos;
+    }
+
+    public static ArtifactRepository buildArtifactRepository( Repository repo,
+                                                             ArtifactRepositoryFactory artifactRepositoryFactory,
+                                                             PlexusContainer container )
+        throws ProjectBuildingException
+    {
+        if ( repo != null )
+        {
+            String id = repo.getId();
+            String url = repo.getUrl();
+            String snapshotPolicy = repo.getSnapshotPolicy();
+            // TODO: make this a map inside the factory instead, so no lookup needed
+            ArtifactRepositoryLayout layout = getRepositoryLayout( repo, container );
+            return artifactRepositoryFactory.createArtifactRepository( id, url, layout, snapshotPolicy );
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    private static ArtifactRepositoryLayout getRepositoryLayout( Repository mavenRepo, PlexusContainer container )
+        throws ProjectBuildingException
+    {
+        String layout = mavenRepo.getLayout();
+
+        ArtifactRepositoryLayout repositoryLayout = null;
+        try
+        {
+            repositoryLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, layout );
+        }
+        catch ( ComponentLookupException e )
+        {
+            throw new ProjectBuildingException( "Cannot find layout implementation corresponding to: \'" + layout
+                + "\' for remote repository with id: \'" + mavenRepo.getId() + "\'.", e );
+        }
+        return repositoryLayout;
+    }
+
+}

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Modified: maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/components/trunk/maven-project/src/main/resources/META-INF/plexus/components.xml Tue Jun  7 20:27:43 2005
@@ -72,6 +72,16 @@
      -->
     <component>
       <role>org.apache.maven.profile.activation.ProfileActivator</role>
+      <role-hint>always-on</role-hint>
+      <implementation>org.apache.maven.profile.activation.AlwaysOnProfileActivator</implementation>
+    </component>
+    <!--
+     |
+     |
+     |
+     -->
+    <component>
+      <role>org.apache.maven.profile.activation.ProfileActivator</role>
       <role-hint>jdk-prefix</role-hint>
       <implementation>org.apache.maven.profile.activation.JdkPrefixProfileActivator</implementation>
     </component>

Modified: maven/components/trunk/maven-settings/settings.mdo
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-settings/settings.mdo?rev=189510&r1=189509&r2=189510&view=diff
==============================================================================
--- maven/components/trunk/maven-settings/settings.mdo (original)
+++ maven/components/trunk/maven-settings/settings.mdo Tue Jun  7 20:27:43 2005
@@ -388,10 +388,14 @@
           </association>
         </field>
         <field>
-          <name>configuration</name>
-          <description>Extended configuration specific to this notifier goes 
+          <name>properties</name>
+          <description>Extended configuration specific to this profile goes 
             here.</description>
-          <type>DOM</type>
+          <type>Properties</type>
+          <association xml.mapStyle="inline">
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
         </field>
         <field>
           <name>repositories</name>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org