PR: MNG-1183

Submitted by: Jerome Lacoste
Make core integration tests aware of user local directory thanks to settings file


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@321323 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-15 12:31:19 +00:00
parent 51b9ce75e5
commit 355edf88bc
3 changed files with 54 additions and 9 deletions

View File

@ -130,7 +130,7 @@ echo -----------------------------------------------------------------------
echo Running integration tests echo Running integration tests
echo ----------------------------------------------------------------------- echo -----------------------------------------------------------------------
cd maven-core-it cd maven-core-it
call maven-core-it call maven-core-it %MAVEN_CMD_LINE_ARGS%
cd .. cd ..
:end :end

View File

@ -74,7 +74,7 @@ ret=$?; if [ $ret != 0 ]; then exit $ret; fi
echo echo
echo "Running maven-core integration tests ..." echo "Running maven-core integration tests ..."
echo echo
./maven-core-it.sh ./maven-core-it.sh $ARGS
ret=$?; if [ $ret != 0 ]; then exit $ret; fi ret=$?; if [ $ret != 0 ]; then exit $ret; fi
) )
ret=$?; if [ $ret != 0 ]; then exit $ret; fi ret=$?; if [ $ret != 0 ]; then exit $ret; fi

View File

@ -406,7 +406,7 @@ public class Verifier
} }
} }
private static String retrieveLocalRepo() private static String retrieveLocalRepo( String[] args )
{ {
String repo = System.getProperty( "maven.repo.local" ); String repo = System.getProperty( "maven.repo.local" );
@ -418,7 +418,18 @@ public class Verifier
{ {
String userHome = System.getProperty( "user.home" ); String userHome = System.getProperty( "user.home" );
File userXml = new File( userHome, ".m2/settings.xml" ); String settingsXmlPath = getSettingsPath( args );
File userXml;
if ( settingsXmlPath != null )
{
System.out.println( "Using settings from " + settingsXmlPath );
userXml = new File( settingsXmlPath );
} else
{
userXml = new File( userHome, ".m2/settings.xml" );
}
if ( userXml.exists() ) if ( userXml.exists() )
{ {
@ -725,6 +736,23 @@ public class Verifier
} }
} }
private static String getSettingsPath( String[] args )
throws Exception
{
for ( int i = 0; i < args.length; i++ ) {
if ( args[ i ].equals( "-s" ) )
{
if ( i == args.length - 1 )
{
throw new Exception( "missing argument to -s" );
}
return args[ i + 1 ];
}
}
return null;
}
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// //
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -733,11 +761,28 @@ public class Verifier
{ {
String basedir = System.getProperty( "user.dir" ); String basedir = System.getProperty( "user.dir" );
localRepo = retrieveLocalRepo(); localRepo = retrieveLocalRepo( args );
List tests = null; List tests = null;
if ( args.length == 0 ) List argsList = new ArrayList();
// skip options
for ( int i = 0; i < args.length; i++ ) {
if ( args[ i ].equals( "-s" ) )
{
if ( i == args.length - 1 )
{
// should have been detected before
throw new IllegalStateException( "missing argument to -s" );
}
i +=1;
continue;
}
argsList.add( args[ i ] );
}
if ( argsList.size() == 0 )
{ {
try try
{ {
@ -754,11 +799,11 @@ public class Verifier
} }
else else
{ {
tests = new ArrayList( args.length ); tests = new ArrayList( argsList.size() );
NumberFormat fmt = new DecimalFormat( "0000" ); NumberFormat fmt = new DecimalFormat( "0000" );
for ( int i = 0; i < args.length; i++ ) for ( int i = 0; i < argsList.size(); i++ )
{ {
String test = args[i]; String test = (String) argsList.get( i );
if ( test.endsWith( "," ) ) if ( test.endsWith( "," ) )
{ {
test = test.substring( 0, test.length() - 1 ); test = test.substring( 0, test.length() - 1 );