o Added detection of Maven version to ease execution of individual ITs via -Dtest=

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@985676 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-08-15 13:50:41 +00:00
parent bfac6a4a70
commit 830da18971
1 changed files with 26 additions and 4 deletions

View File

@ -133,11 +133,33 @@ public abstract class AbstractMavenIntegrationTestCase
{
if ( mavenVersion == null )
{
String v = System.getProperty( "maven.version" );
// NOTE: If the version looks like "${...}" it has been configured from an undefined expression
if ( v != null && v.length() > 0 && !v.startsWith( "${" ) )
String version = System.getProperty( "maven.version", "" );
if ( version.length() <= 0 || version.startsWith( "${" ) )
{
mavenVersion = new DefaultArtifactVersion( v );
try
{
Verifier verifier = new Verifier( "" );
try
{
version = verifier.getMavenVersion();
System.setProperty( "maven.version", version );
}
finally
{
verifier.resetStreams();
}
}
catch ( VerificationException e )
{
e.printStackTrace();
}
}
// NOTE: If the version looks like "${...}" it has been configured from an undefined expression
if ( version != null && version.length() > 0 && !version.startsWith( "${" ) )
{
mavenVersion = new DefaultArtifactVersion( version );
}
}
return mavenVersion;