You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/08/15 15:50:41 UTC
svn commit: r985676 -
/maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
Author: bentmann
Date: Sun Aug 15 13:50:41 2010
New Revision: 985676
URL: http://svn.apache.org/viewvc?rev=985676&view=rev
Log:
o Added detection of Maven version to ease execution of individual ITs via -Dtest=
Modified:
maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
Modified: maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java?rev=985676&r1=985675&r2=985676&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java (original)
+++ maven/core-integration-testing/trunk/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java Sun Aug 15 13:50:41 2010
@@ -133,11 +133,33 @@ public abstract class AbstractMavenInteg
{
if ( mavenVersion == null )
{
- String v = System.getProperty( "maven.version" );
+ String version = System.getProperty( "maven.version", "" );
+
+ if ( version.length() <= 0 || version.startsWith( "${" ) )
+ {
+ 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 ( v != null && v.length() > 0 && !v.startsWith( "${" ) )
+ if ( version != null && version.length() > 0 && !version.startsWith( "${" ) )
{
- mavenVersion = new DefaultArtifactVersion( v );
+ mavenVersion = new DefaultArtifactVersion( version );
}
}
return mavenVersion;