Author: mkleint Date: Wed Nov 21 10:20:35 2007 New Revision: 597168 URL: http://svn.apache.org/viewvc?rev=597168&view=rev Log: use MavenSession for ToolchainManager calls, plugin requires 2.1-SNAPSHOT now
Modified: maven/plugins/branches/MNG-468/maven-compiler-plugin/pom.xml maven/plugins/branches/MNG-468/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java Modified: maven/plugins/branches/MNG-468/maven-compiler-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/branches/MNG-468/maven-compiler-plugin/pom.xml?rev=597168&r1=597167&r2=597168&view=diff ============================================================================== --- maven/plugins/branches/MNG-468/maven-compiler-plugin/pom.xml (original) +++ maven/plugins/branches/MNG-468/maven-compiler-plugin/pom.xml Wed Nov 21 10:20:35 2007 @@ -11,7 +11,7 @@ <version>2.1-SNAPSHOT</version> <inceptionYear>2001</inceptionYear> <prerequisites> - <maven>2.0</maven> + <maven>2.1-SNAPSHOT</maven> </prerequisites> <issueManagement> <system>JIRA</system> Modified: maven/plugins/branches/MNG-468/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/branches/MNG-468/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java?rev=597168&r1=597167&r2=597168&view=diff ============================================================================== --- maven/plugins/branches/MNG-468/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java (original) +++ maven/plugins/branches/MNG-468/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java Wed Nov 21 10:20:35 2007 @@ -41,7 +41,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.maven.context.BuildContextManager; +import org.apache.maven.execution.MavenSession; import org.apache.maven.toolchain.Toolchain; import org.apache.maven.toolchain.ToolchainManager; @@ -249,10 +249,14 @@ private ToolchainManager 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; protected abstract SourceInclusionScanner getSourceInclusionScanner( int staleMillis ); @@ -288,16 +292,20 @@ } //use the compilerId as identifier for toolchains as well. - Toolchain tc = toolchainManager.getToolchainFromBuildContext(compilerId, - buildContextManager.readBuildContext(true)); - if (tc != null) { - getLog().info("Toolchain in compiler-plugin: " + tc); - if ( executable != null) { - getLog().warn("Toolchains are ignored, 'executable' parameter is set to " + executable); - } else { + Toolchain tc = toolchainManager.getToolchainFromBuildContext( compilerId, + session ); + if ( tc != null ) + { + getLog().info( "Toolchain in compiler-plugin: " + tc ); + if ( executable != null ) + { + getLog().warn( "Toolchains are ignored, 'executable' parameter is set to " + executable ); + } + else + { fork = true; //TODO somehow shaky dependency between compilerId and tool executable. - executable = tc.findTool(compilerId); + executable = tc.findTool( compilerId ); } } // ----------------------------------------------------------------------