You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2020/06/06 20:30:27 UTC

[maven-integration-testing] branch master updated: [MNG-5937] fail in setUp() instead of constructor gives better reporting

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

hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git


The following commit(s) were added to refs/heads/master by this push:
     new 042071a  [MNG-5937] fail in setUp() instead of constructor gives better reporting
042071a is described below

commit 042071ab5476fd00fab424be8964000e54fc4240
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sat Jun 6 22:30:22 2020 +0200

    [MNG-5937] fail in setUp() instead of constructor gives better reporting
---
 .../maven/it/MavenITmng5937MavenWrapper.java       | 35 ++++++++++++----------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java
index 5610f9b..6c46cfc 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java
@@ -41,7 +41,7 @@ import org.codehaus.plexus.util.StringUtils;
 public class MavenITmng5937MavenWrapper
     extends AbstractMavenIntegrationTestCase
 {
-    private final Path wrapperDistro;
+    private Path wrapperDistro;
     
     private final Map<String,String> envVars;
     
@@ -49,10 +49,28 @@ public class MavenITmng5937MavenWrapper
     
     private ZipUnArchiver zipUnArchiver = new ZipUnArchiver();
     
-    public MavenITmng5937MavenWrapper() throws Exception
+    public MavenITmng5937MavenWrapper()
+        throws Exception
     {
         super( "[3.7.0,)" );
         
+        String localRepo = System.getProperty("maven.repo.local");
+        
+        envVars = new HashMap<>( 4 );
+        envVars.put( "MVNW_REPOURL", Paths.get( localRepo ).toUri().toURL().toString() );
+        envVars.put( "MVNW_VERBOSE", "true" );
+        String javaHome = System.getenv( "JAVA_HOME" );
+        if ( javaHome != null )
+        {
+            // source needs to call the javac executable.
+            // if JAVA_HOME is not set, ForkedLauncher sets it to java.home, which is the JRE home
+            envVars.put( "JAVA_HOME", javaHome );
+        }
+    }
+
+    public void setUp()
+        throws Exception
+    {
         String mavenDist = System.getProperty( "maven.distro" );
         if ( StringUtils.isEmpty( mavenDist ) )
         {
@@ -74,19 +92,6 @@ public class MavenITmng5937MavenWrapper
             throw new IllegalStateException( "Missing maven.wrapper.distrodir=${wrapperDistroDir} parameter to test maven-wrapper: see run ITs instructions" );
         }
         wrapperDistro = Paths.get( distroValue );
-        
-        String localRepo = System.getProperty("maven.repo.local");
-        
-        envVars = new HashMap<>( 4 );
-        envVars.put( "MVNW_REPOURL", Paths.get( localRepo ).toUri().toURL().toString() );
-        envVars.put( "MVNW_VERBOSE", "true" );
-        String javaHome = System.getenv( "JAVA_HOME" );
-        if ( javaHome != null )
-        {
-            // source needs to call the javac executable.
-            // if JAVA_HOME is not set, ForkedLauncher sets it to java.home, which is the JRE home
-            envVars.put( "JAVA_HOME", javaHome );
-        }
     }
 
     public void testitMNG5937Bin()