maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r355878 - /maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
Date Sun, 11 Dec 2005 02:57:41 GMT
Author: brett
Date: Sat Dec 10 18:57:38 2005
New Revision: 355878

URL: http://svn.apache.org/viewcvs?rev=355878&view=rev
Log:
enable activeByDefault from settings.xml
PR: MNG-1586
Submitted by: Edwin Punzalan

Modified:
    maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java

Modified: maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java?rev=355878&r1=355877&r2=355878&view=diff
==============================================================================
--- maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
(original)
+++ maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
Sat Dec 10 18:57:38 2005
@@ -30,6 +30,8 @@
 import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * @author jdcasey
@@ -150,6 +152,8 @@
             }
 
             SettingsUtils.merge( userSettings, globalSettings, TrackableBase.GLOBAL_LEVEL
);
+            
+            activateDefaultProfiles( userSettings );
 
             setLocalRepository( userSettings );
 
@@ -157,6 +161,23 @@
         }
 
         return loadedSettings;
+    }
+
+    private void activateDefaultProfiles( Settings settings )
+    {
+        List activeProfiles = settings.getActiveProfiles();
+        
+        for( Iterator profiles = settings.getProfiles().iterator(); profiles.hasNext(); )
+        {
+            Profile profile = (Profile) profiles.next();
+            if ( profile.getActivation() != null && profile.getActivation().isActiveByDefault()
)
+            {
+                if ( !activeProfiles.contains( profile.getId() ) )
+                {
+                    settings.addActiveProfile( profile.getId() );
+                }
+            }
+        }
     }
 
     private void setLocalRepository( Settings userSettings )



Mime
View raw message