Author: mkleint
Date: Wed Nov 21 09:51:45 2007
New Revision: 597161

URL: http://svn.apache.org/viewvc?rev=597161&view=rev
Log:
rewrite toolchain-plugin to use MavenSession plugin context instead of removed 
build-context.

Modified:
    
maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java

Modified: 
maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java?rev=597161&r1=597160&r2=597161&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
 Wed Nov 21 09:51:45 2007
@@ -24,7 +24,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import org.apache.maven.context.BuildContextManager;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -51,10 +51,14 @@
     private ToolchainManagerPrivate toolchainManager;
 
     /**
+     * The current build session instance. This is used for
+     * toolchain manager API calls.
      *
-     * @component
+     * @parameter expression="${session}"
+     * @required
+     * @readonly
      */
-    private BuildContextManager buildContextManager;
+    private MavenSession session;
 
     /**
      * @parameter
@@ -88,7 +92,7 @@
                         {
                             getLog(  ).info( "Toolchain (" + type + ") 
matched:" + tcs[i] );
                             toolchainManager.storeToolchainToBuildContext( 
tcs[i],
-                                buildContextManager.readBuildContext( true ) );
+                                session );
                             matched = true;
                             break;
                         }
@@ -127,7 +131,7 @@
                     }
                 }
                 getLog().error( str );
-                throw new MojoFailureException( "Please make sure you define 
the required toolchains in your ~/.m2/toolchains.xml file." );
+                throw new MojoFailureException( str + "\nPlease make sure you 
define the required toolchains in your ~/.m2/toolchains.xml file." );
             }
         }
         else


Reply via email to