diff --git a/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java b/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java index 3ce6e2bf2c..ff34e21b77 100644 --- a/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java +++ b/bootstrap/bootstrap-installer/src/main/java/org/apache/maven/bootstrap/installer/BootstrapInstaller.java @@ -43,6 +43,8 @@ import java.util.Iterator; */ public class BootstrapInstaller { + private static final String MAVEN_GROUPID = "org.apache.maven"; + private final Bootstrap bootstrapper; private final String prefix; @@ -117,7 +119,7 @@ public class BootstrapInstaller 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" ); createInstallation( installation, mavenCliModel ); diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java index bb40ebb9ad..e28ca30a9a 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java @@ -35,6 +35,10 @@ import java.util.Properties; public class DefaultRuntimeInformation 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; public ArtifactVersion getApplicationVersion() @@ -49,8 +53,12 @@ public class DefaultRuntimeInformation try { Properties properties = new Properties(); - resourceAsStream = getClass().getClassLoader().getResourceAsStream( - "META-INF/maven/org.apache.maven/maven-core/pom.properties" ); + resourceAsStream = getClass().getClassLoader().getResourceAsStream( MAVEN_PROPERTIES ); + + if ( resourceAsStream == null ) + { + throw new IllegalStateException( "Unable to find Maven properties in classpath: " + MAVEN_PROPERTIES ); + } properties.load( resourceAsStream ); String property = properties.getProperty( "version" );