maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r760322 - /maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
Date Tue, 31 Mar 2009 04:50:10 GMT
Author: jvanzyl
Date: Tue Mar 31 04:50:09 2009
New Revision: 760322

URL: http://svn.apache.org/viewvc?rev=760322&view=rev
Log:
o use injection for the toolchain manager

Modified:
    maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java

Modified: maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?rev=760322&r1=760321&r2=760322&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
(original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
Tue Mar 31 04:50:09 2009
@@ -58,21 +58,9 @@
 import org.apache.maven.surefire.report.FileReporter;
 import org.apache.maven.surefire.report.ForkingConsoleReporter;
 import org.apache.maven.surefire.report.XMLReporter;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import org.apache.maven.execution.MavenSession;
 import org.apache.maven.toolchain.Toolchain;
 import org.apache.maven.toolchain.ToolchainManager;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * Run tests using Surefire.
@@ -484,6 +472,8 @@
      */
     private ArtifactMetadataSource metadataSource;
 
+    
+    
     private static final String BRIEF_REPORT_FORMAT = "brief";
 
     private static final String PLAIN_REPORT_FORMAT = "plain";
@@ -553,6 +543,10 @@
      */
     private String objectFactory;
 
+    /** @component */
+    private ToolchainManager toolchainManager;
+    
+    
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
@@ -1181,19 +1175,12 @@
     private Toolchain getToolchain()
     {
         Toolchain tc = null;
-        try
+        
+        if ( toolchainManager != null )
         {
-            if (session != null) //session is null in tests..
-            {
-                ToolchainManager toolchainManager = (ToolchainManager) session.getContainer().lookup(ToolchainManager.ROLE);
-                if (toolchainManager != null)
-                {
-                    tc = toolchainManager.getToolchainFromBuildContext("jdk", session);
-                }
-            }
-        } catch (ComponentLookupException componentLookupException) {
-            //just ignore, could happen in pre-2.0.9 builds..
+            tc = toolchainManager.getToolchainFromBuildContext( "jdk", session );
         }
+        
         return tc;
     }
 }



Mime
View raw message