o Added factory method to create verifier setup with global settings

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@981694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-08-02 21:37:46 +00:00
parent 9720c0d503
commit ee063d5cb2
1 changed files with 47 additions and 0 deletions

View File

@ -378,4 +378,51 @@ public abstract class AbstractMavenIntegrationTestCase
}
return version;
}
protected Verifier newVerifier( File basedir )
throws VerificationException
{
return newVerifier( basedir.getAbsolutePath() );
}
protected Verifier newVerifier( String basedir )
throws VerificationException
{
return newVerifier( basedir, false );
}
protected Verifier newVerifier( String basedir, boolean debug )
throws VerificationException
{
Verifier verifier = new Verifier( basedir, debug );
verifier.setAutoclean( false );
String globalSettings = System.getProperty( "maven.test.global-settings", "" );
if ( globalSettings.length() > 0 )
{
globalSettings = new File( globalSettings ).getAbsolutePath();
// dedicated CLI option only available since MNG-3914
if ( matchesVersionRange( "[2.1.0,)" ) )
{
verifier.getCliOptions().add( "--global-settings" );
if ( globalSettings.indexOf( ' ' ) < 0 )
{
verifier.getCliOptions().add( globalSettings );
}
else
{
verifier.getCliOptions().add( '"' + globalSettings + '"' );
}
}
else
{
verifier.getSystemProperties().put( "org.apache.maven.global-settings", globalSettings );
}
}
return verifier;
}
}