You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2019/08/04 14:17:19 UTC

[maven-integration-testing] 01/02: [MNG-6725] Skip '.mavenrc' via MAVEN_SKIP_RC=1 and '-Dmaven.skip.rc=true' on child ITs (by default on Jenkins CI).

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch removed-java-tools-2
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git

commit 78e14cb619102a499f40893c9dcb82768709f8f5
Author: tibordigana <ti...@apache.org>
AuthorDate: Tue Jul 30 11:47:46 2019 +0200

    [MNG-6725] Skip '.mavenrc' via MAVEN_SKIP_RC=1 and '-Dmaven.skip.rc=true' on child ITs (by default on Jenkins CI).
    
    (cherry picked from commit 1d5db0a67c4595b853a012ec984c246ba078b374)
---
 core-it-suite/pom.xml                              |  4 ++++
 .../maven/it/AbstractMavenIntegrationTestCase.java | 27 ++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/core-it-suite/pom.xml b/core-it-suite/pom.xml
index e1c484d..444b31c 100644
--- a/core-it-suite/pom.xml
+++ b/core-it-suite/pom.xml
@@ -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>
diff --git a/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java b/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
index 7e3c42a..102f3e7 100644
--- a/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
+++ b/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
@@ -43,6 +43,11 @@ 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.
      */
     private static PrintStream out = System.out;
@@ -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;
+    }
 }