Remove unused method, consolidate if blocks

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@419885 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Carlos Sanchez Gonzalez 2006-07-07 12:46:49 +00:00
parent f7a33ca068
commit bd98854481
1 changed files with 3 additions and 47 deletions

View File

@ -134,55 +134,11 @@ public class DefaultMavenSettingsBuilder
for ( Iterator profiles = settings.getProfiles().iterator(); profiles.hasNext(); )
{
Profile profile = (Profile) profiles.next();
if ( profile.getActivation() != null && profile.getActivation().isActiveByDefault() )
if ( profile.getActivation() != null && profile.getActivation().isActiveByDefault()
&& !activeProfiles.contains( profile.getId() ) )
{
if ( !activeProfiles.contains( profile.getId() ) )
{
settings.addActiveProfile( profile.getId() );
}
settings.addActiveProfile( profile.getId() );
}
}
}
private File getFile( String pathPattern, String basedirSysProp, String altLocationSysProp )
{
// -------------------------------------------------------------------------------------
// Alright, here's the justification for all the regexp wizardry below...
//
// Continuum and other server-like apps may need to locate the user-level and
// global-level settings somewhere other than ${user.home} and ${maven.home},
// respectively. Using a simple replacement of these patterns will allow them
// to specify the absolute path to these files in a customized components.xml
// file. Ideally, we'd do full pattern-evaluation against the sysprops, but this
// is a first step. There are several replacements below, in order to normalize
// the path character before we operate on the string as a regex input, and
// in order to avoid surprises with the File construction...
// -------------------------------------------------------------------------------------
String path = System.getProperty( altLocationSysProp );
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 basedir = System.getProperty( basedirSysProp );
if ( basedir == null )
{
basedir = System.getProperty( "user.dir" );
}
basedir = basedir.replaceAll( "\\\\", "/" );
basedir = basedir.replaceAll( "\\$", "\\\\\\$" );
path = pathPattern.replaceAll( "\\$\\{" + basedirSysProp + "\\}", basedir );
path = path.replaceAll( "\\\\", "/" );
path = path.replaceAll( "//", "/" );
return new File( path ).getAbsoluteFile();
}
else
{
return new File( path ).getAbsoluteFile();
}
}
}