[MNG-6725] Skip '.mavenrc' via MAVEN_SKIP_RC=1 and '-Dmaven.skip.rc=true' on child ITs (by default on Jenkins CI).

This commit is contained in:
tibordigana 2019-07-30 11:47:46 +02:00
parent 829e923b00
commit f576fefa0a
2 changed files with 31 additions and 0 deletions

View File

@ -193,6 +193,10 @@ under the License.
<name>maven.it.global-settings.dir</name>
<value>${project.build.testOutputDirectory}</value>
</property>
<property>
<name>maven.skip.rc</name>
<value>${maven.skip.rc}</value>
</property>
</systemProperties>
</configuration>
</plugin>

View File

@ -42,6 +42,11 @@ import java.util.regex.Pattern;
public abstract class AbstractMavenIntegrationTestCase
extends TestCase
{
/**
* Skips using ".mavenrc" on the system. For more information, see 'MAVEN_SKIP_RC' in $MAVEN_DIST/bin/mvn.
*/
private static final boolean MAVEN_SKIP_RC = isMavenSkipRc();
/**
* Save System.out for progress reports etc.
*/
@ -495,6 +500,11 @@ public abstract class AbstractMavenIntegrationTestCase
{
Verifier verifier = new Verifier( basedir, debug );
if ( MAVEN_SKIP_RC )
{
verifier.setEnvironmentVariable( "MAVEN_SKIP_RC", "1" );
}
verifier.setAutoclean( false );
if ( settings != null )
@ -601,4 +611,21 @@ public abstract class AbstractMavenIntegrationTestCase
{
assertCanonicalFileEquals( null, new File( expected ), new File( actual ) );
}
private static boolean isMavenSkipRc()
{
boolean skipRc = Boolean.getBoolean( "maven.skip.rc" );
if ( skipRc )
{
System.out.println( "SKIPPED - Skipped '.mavenrc'!" );
}
else
{
System.out.println( "In order to disable '.mavenrc' set the system property 'maven.skip.rc', i.e. "
+ "'mvn -Dmaven.skip.rc=true -P run-its verify'." );
}
return skipRc;
}
}