Use constants for maven groupId

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@425105 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Carlos Sanchez Gonzalez 2006-07-24 16:04:09 +00:00
parent 92e731eb80
commit d8ceac328a
2 changed files with 13 additions and 3 deletions

View File

@ -43,6 +43,8 @@ import java.util.Iterator;
*/ */
public class BootstrapInstaller public class BootstrapInstaller
{ {
private static final String MAVEN_GROUPID = "org.apache.maven";
private final Bootstrap bootstrapper; private final Bootstrap bootstrapper;
private final String prefix; private final String prefix;
@ -117,7 +119,7 @@ public class BootstrapInstaller
bootstrapper.buildProject( new File( basedir ), true ); bootstrapper.buildProject( new File( basedir ), true );
Model mavenCliModel = bootstrapper.getCachedModel( "org.apache.maven", "maven-cli" ); Model mavenCliModel = bootstrapper.getCachedModel( MAVEN_GROUPID, "maven-cli" );
File installation = new File( basedir, "bootstrap/target/installation" ); File installation = new File( basedir, "bootstrap/target/installation" );
createInstallation( installation, mavenCliModel ); createInstallation( installation, mavenCliModel );

View File

@ -35,6 +35,10 @@ import java.util.Properties;
public class DefaultRuntimeInformation public class DefaultRuntimeInformation
implements RuntimeInformation, Initializable implements RuntimeInformation, Initializable
{ {
private static final String MAVEN_GROUPID = "org.apache.maven";
private static final String MAVEN_PROPERTIES = "META-INF/maven/" + MAVEN_GROUPID + "/maven-core/pom.properties";
private ArtifactVersion applicationVersion; private ArtifactVersion applicationVersion;
public ArtifactVersion getApplicationVersion() public ArtifactVersion getApplicationVersion()
@ -49,8 +53,12 @@ public class DefaultRuntimeInformation
try try
{ {
Properties properties = new Properties(); Properties properties = new Properties();
resourceAsStream = getClass().getClassLoader().getResourceAsStream( resourceAsStream = getClass().getClassLoader().getResourceAsStream( MAVEN_PROPERTIES );
"META-INF/maven/org.apache.maven/maven-core/pom.properties" );
if ( resourceAsStream == null )
{
throw new IllegalStateException( "Unable to find Maven properties in classpath: " + MAVEN_PROPERTIES );
}
properties.load( resourceAsStream ); properties.load( resourceAsStream );
String property = properties.getProperty( "version" ); String property = properties.getProperty( "version" );