maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r760320 - in /maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin: AbstractCompilerMojo.java CompilationFailureException.java
Date Tue, 31 Mar 2009 04:49:06 GMT
Author: jvanzyl
Date: Tue Mar 31 04:49:06 2009
New Revision: 760320

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

Modified:
    maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
    maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilationFailureException.java

Modified: maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java?rev=760320&r1=760319&r2=760320&view=diff
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
(original)
+++ maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
Tue Mar 31 04:49:06 2009
@@ -229,6 +229,9 @@
      */
     private String debuglevel;    
 
+    /** @component */
+    private ToolchainManager toolchainManager;
+    
     // ----------------------------------------------------------------------
     // Read-only parameters
     // ----------------------------------------------------------------------
@@ -643,21 +646,12 @@
 
     //TODO remove the part with ToolchainManager lookup once we depend on
     //3.0.9 (have it as prerequisite). Define as regular component field then.
-    private Toolchain getToolchain() 
+    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-3.0.9 builds..
+            tc = toolchainManager.getToolchainFromBuildContext( "jdk", session );
         }
         return tc;
     }

Modified: maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilationFailureException.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilationFailureException.java?rev=760320&r1=760319&r2=760320&view=diff
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilationFailureException.java
(original)
+++ maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilationFailureException.java
Tue Mar 31 04:49:06 2009
@@ -73,6 +73,7 @@
 
             sb.append( compilerError ).append( LS );
         }
+        
         return sb.toString();
     }
 }



Mime
View raw message