Author: jdcasey
Date: Sat Jun 18 15:38:49 2005
New Revision: 191309
URL: http://svn.apache.org/viewcvs?rev=191309&view=rev
Log:
PR: MNG-487
Modified:
maven/components/trunk/maven-settings/settings.mdo
maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
Modified: maven/components/trunk/maven-settings/settings.mdo
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-settings/settings.mdo?rev=191309&r1=191308&r2=191309&view=diff
==============================================================================
--- maven/components/trunk/maven-settings/settings.mdo (original)
+++ maven/components/trunk/maven-settings/settings.mdo Sat Jun 18 15:38:49 2005
@@ -264,6 +264,33 @@
return match;
}
+ private Map profileMap;
+
+ public void flushProfileMap()
+ {
+ this.profileMap = null;
+ }
+
+ public Map getProfilesAsMap()
+ {
+ if ( profileMap == null )
+ {
+ profileMap = new HashMap();
+
+ if ( getProfiles() != null )
+ {
+ for ( Iterator it = getProfiles().iterator(); it.hasNext(); )
+ {
+ Profile profile = (Profile) it.next();
+
+ profileMap.put( profile.getId(), profile );
+ }
+ }
+ }
+
+ return profileMap;
+ }
+
private RuntimeInfo runtimeInfo;
public void setRuntimeInfo( RuntimeInfo runtimeInfo )
@@ -464,6 +491,13 @@
<association>
<type>Activation</type>
</association>
+ </field>
+ <field>
+ <name>localRepository</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description>backwards-compatible location for specifying the local
repository for use in builds</description>
+ <comment>THIS IS DEPRECATED: use localRepository under the root
element instead.</comment>
</field>
<field>
<name>properties</name>
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=191309&r1=191308&r2=191309&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 Jun 18 15:38:49 2005
@@ -26,6 +26,8 @@
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
/**
* @author jdcasey
@@ -115,16 +117,47 @@
SettingsUtils.merge( userSettings, globalSettings,
TrackableBase.GLOBAL_LEVEL );
+ setLocalRepository( userSettings );
+
+ return userSettings;
+ }
+
+ private void setLocalRepository( Settings userSettings )
+ {
// try using the local repository specified on the command line...
String localRepository = System.getProperty(
MavenSettingsBuilder.ALT_LOCAL_REPOSITORY_LOCATION );
-
+
// otherwise, use the one in settings.xml
if ( localRepository == null || localRepository.length() < 1 )
{
localRepository = userSettings.getLocalRepository();
}
-
- // if both are missing, default to ~/.m2/repository.
+
+ // this is a backward compatibility feature...
+ if ( localRepository == null || localRepository.length() < 1 )
+ {
+ List profiles = userSettings.getProfiles();
+
+ for ( Iterator it = profiles.iterator(); it.hasNext(); )
+ {
+ Profile profile = (Profile) it.next();
+
+ localRepository = profile.getLocalRepository();
+
+ if ( localRepository != null && localRepository.length() > 0 )
+ {
+ getLogger().warn(
+ "DEPRECATED: Please specify the local
repository as:\n\n<settings>"
+ + "\n <localRepository>" +
localRepository + "</localRepository>"
+ + "\n ...\n</settings>\n" );
+
+ // we've found it! so stop looking through the profiles...
+ break;
+ }
+ }
+ }
+
+ // if all of the above are missing, default to ~/.m2/repository.
if ( localRepository == null || localRepository.length() < 1 )
{
File mavenUserConfigurationDirectory = new File( userHome, ".m2" );
@@ -140,8 +173,6 @@
}
userSettings.setLocalRepository( localRepository );
-
- return userSettings;
}
private File getFile( String pathPattern, String basedirSysProp, String
altLocationSysProp )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]