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

gnodet pushed a commit to branch mvn4
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git


The following commit(s) were added to refs/heads/mvn4 by this push:
     new f8756af  Switch a few core plugins to the new api
f8756af is described below

commit f8756af72d1cd684cc39188eaba41545461cf662
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Feb 24 17:00:56 2022 +0100

    Switch a few core plugins to the new api
---
 pom.xml                                            |  25 +-
 .../main/java/org/issue/SourcePathReadGoal.java    |   5 +-
 .../main/java/org/issue/SourcePathReadGoal.java    |   5 +-
 .../apache/maven/plugin/AbstractCompilerMojo.java  |  38 ---
 .../maven/plugin/CompilationFailureException.java  |  40 ---
 .../java/org/apache/maven/plugin/CompilerMojo.java |  34 --
 .../org/apache/maven/plugin/TestCompilerMojo.java  |  34 --
 .../plugin/compiler/AbstractCompilerMojo.java      | 303 ++++++++---------
 .../compiler/CompilationFailureException.java      |   4 +-
 .../apache/maven/plugin/compiler/CompilerMojo.java |  68 ++--
 .../plugin/compiler/IncrementalBuildHelper.java    | 362 +++++++++++++++++++++
 .../compiler/IncrementalBuildHelperRequest.java    |  76 +++++
 .../maven/plugin/compiler/TestCompilerMojo.java    |  48 +--
 .../plugin/compiler/CompilerMojoTestCase.java      |  20 +-
 14 files changed, 647 insertions(+), 415 deletions(-)

diff --git a/pom.xml b/pom.xml
index 550c5c6..27d1c73 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@ under the License.
     <javaVersion>8</javaVersion>
     <maven.it.failure.ignore>false</maven.it.failure.ignore>
     <surefire.version>2.22.2</surefire.version>
-    <mavenPluginToolsVersion>3.6.2</mavenPluginToolsVersion>
+    <mavenPluginToolsVersion>3.6.5-SNAPSHOT</mavenPluginToolsVersion>
     
<project.build.outputTimestamp>2022-01-09T12:19:13Z</project.build.outputTimestamp>
   </properties>
 
@@ -97,27 +97,10 @@ under the License.
     </dependencies>
   </dependencyManagement>
   <dependencies>
-    <dependency>
-      <groupId>org.apache.maven.plugin-tools</groupId>
-      <artifactId>maven-plugin-annotations</artifactId>
-      <scope>provided</scope>
-    </dependency>
     <!-- Maven -->
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-plugin-api</artifactId>
-      <version>${mavenVersion}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
-      <version>${mavenVersion}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-core</artifactId>
+      <artifactId>maven-core-api</artifactId>
       <version>${mavenVersion}</version>
       <scope>provided</scope>
     </dependency>
@@ -126,10 +109,11 @@ under the License.
       <artifactId>maven-shared-utils</artifactId>
       <version>4.0.0-SNAPSHOT</version>
     </dependency>
+    <!--
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-shared-incremental</artifactId>
-      <version>1.1</version>
+      <version>2.0.0-SNAPSHOT</version>
       <exclusions>
         <exclusion>
           <artifactId>maven-core</artifactId>
@@ -145,6 +129,7 @@ under the License.
         </exclusion>
       </exclusions>
     </dependency>
+    -->
 
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
diff --git 
a/src/it/MCOMPILER-157/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
 
b/src/it/MCOMPILER-157/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
index aafec6f..aad8dce 100644
--- 
a/src/it/MCOMPILER-157/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
+++ 
b/src/it/MCOMPILER-157/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
@@ -49,7 +48,7 @@ public class SourcePathReadGoal
 
     @SuppressWarnings( "unchecked" )
     public void execute()
-        throws MojoExecutionException, MojoFailureException
+        throws MojoExecutionException
     {
         if ( sourceClass != null )
         {
@@ -65,7 +64,7 @@ public class SourcePathReadGoal
     }
 
     private void assertGeneratedSourceFileFor( String sourceClass, 
List<String> sourceRoots )
-        throws MojoFailureException, MojoExecutionException
+        throws MojoExecutionException
     {
         String sourceFile = sourceClass.replace( '.', '/' )
                                        .concat( ".txt" );
diff --git 
a/src/it/MCOMPILER-203-processorpath/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
 
b/src/it/MCOMPILER-203-processorpath/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
index 971870f..28450c2 100644
--- 
a/src/it/MCOMPILER-203-processorpath/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
+++ 
b/src/it/MCOMPILER-203-processorpath/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
@@ -49,7 +48,7 @@ public class SourcePathReadGoal
 
     @SuppressWarnings( "unchecked" )
     public void execute()
-        throws MojoExecutionException, MojoFailureException
+        throws MojoExecutionException
     {
         if ( sourceClass != null )
         {
@@ -65,7 +64,7 @@ public class SourcePathReadGoal
     }
 
     private void assertGeneratedSourceFileFor( String sourceClass, 
List<String> sourceRoots )
-        throws MojoFailureException, MojoExecutionException
+        throws MojoExecutionException
     {
         String sourceFile = sourceClass.replace( '.', '/' )
                                        .concat( ".txt" );
diff --git a/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java 
b/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
deleted file mode 100644
index 4a69cfc..0000000
--- a/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.maven.plugin;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * TODO: At least one step could be optimized, currently the plugin will do two
- * scans of all the source code if the compiler has to have the entire set of
- * sources. This is currently the case for at least the C# compiler and most
- * likely all the other .NET compilers too.
- *
- * @author others
- * @author <a href="mailto:[email protected]";>Trygve Laugst&oslash;l</a>
- * @since 2.0
- * @deprecated package change since 3.0
- */
-@Deprecated
-public abstract class AbstractCompilerMojo
-    extends org.apache.maven.plugin.compiler.AbstractCompilerMojo
-{
-    // no op only here for backward comp
-}
diff --git 
a/src/main/java/org/apache/maven/plugin/CompilationFailureException.java 
b/src/main/java/org/apache/maven/plugin/CompilationFailureException.java
deleted file mode 100644
index dbf8c3d..0000000
--- a/src/main/java/org/apache/maven/plugin/CompilationFailureException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.apache.maven.plugin;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.codehaus.plexus.compiler.CompilerMessage;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:[email protected]";>Jason van Zyl</a>
- * @version $Id$
- * @deprecated package change since 3.0
- */
-@SuppressWarnings ( "serial" )
-@Deprecated
-public class CompilationFailureException
-    extends org.apache.maven.plugin.compiler.CompilationFailureException
-{
-    public CompilationFailureException( List<CompilerMessage> messages )
-    {
-        super( messages );
-    }
-}
diff --git a/src/main/java/org/apache/maven/plugin/CompilerMojo.java 
b/src/main/java/org/apache/maven/plugin/CompilerMojo.java
deleted file mode 100644
index 20a1fa1..0000000
--- a/src/main/java/org/apache/maven/plugin/CompilerMojo.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.apache.maven.plugin;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Compiles application sources
- *
- * @author <a href="mailto:[email protected]";>Jason van Zyl </a>
- * @since 2.0
- * @deprecated package change since 3.0
- */
-@Deprecated
-public class CompilerMojo
-    extends org.apache.maven.plugin.compiler.CompilerMojo
-{
-    // no op only here for backward comp
-}
diff --git a/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java 
b/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java
deleted file mode 100644
index 021d4db..0000000
--- a/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.apache.maven.plugin;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Compiles application test sources.
- *
- * @author <a href="mailto:[email protected]";>Jason van Zyl</a>
- * @since 2.0
- * @deprecated package change since 3.0
- */
-@Deprecated
-public class TestCompilerMojo
-    extends org.apache.maven.plugin.compiler.TestCompilerMojo
-{
-    // no op only here for backward comp
-}
diff --git 
a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java 
b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
index 93fa6aa..29c6e07 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -22,7 +22,6 @@ package org.apache.maven.plugin.compiler;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
@@ -37,34 +36,26 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Properties;
 import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DefaultArtifact;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
-import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecution;
-import org.apache.maven.plugin.MojoExecutionException;
+import java.util.stream.Collectors;
+
+import org.apache.maven.api.MojoExecution;
+import org.apache.maven.api.Project;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.Toolchain;
+import org.apache.maven.api.plugin.Mojo;
+import org.apache.maven.api.plugin.MojoException;
+import org.apache.maven.api.services.ProjectManager;
+import org.apache.maven.api.services.ToolchainManager;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.repository.RepositorySystem;
-import org.apache.maven.shared.incremental.IncrementalBuildHelper;
-import org.apache.maven.shared.incremental.IncrementalBuildHelperRequest;
 import org.apache.maven.shared.utils.ReaderFactory;
 import org.apache.maven.shared.utils.StringUtils;
 import org.apache.maven.shared.utils.io.FileUtils;
 import org.apache.maven.shared.utils.logging.MessageBuilder;
 import org.apache.maven.shared.utils.logging.MessageUtils;
-import org.apache.maven.toolchain.Toolchain;
-import org.apache.maven.toolchain.ToolchainManager;
 import org.codehaus.plexus.compiler.Compiler;
 import org.codehaus.plexus.compiler.CompilerConfiguration;
 import org.codehaus.plexus.compiler.CompilerError;
@@ -82,6 +73,8 @@ import 
org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
 import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
 import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor;
 import org.codehaus.plexus.languages.java.version.JavaVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * TODO: At least one step could be optimized, currently the plugin will do two
@@ -93,8 +86,7 @@ import org.codehaus.plexus.languages.java.version.JavaVersion;
  * @author <a href="mailto:[email protected]";>Trygve Laugst&oslash;l</a>
  * @since 2.0
  */
-public abstract class AbstractCompilerMojo
-    extends AbstractMojo
+public abstract class AbstractCompilerMojo implements Mojo
 {
     protected static final String PS = System.getProperty( "path.separator" );
 
@@ -104,7 +96,9 @@ public abstract class AbstractCompilerMojo
     
     // Used to compare with older targets
     static final String MODULE_INFO_TARGET = "1.9";
-    
+
+    protected final Logger logger = LoggerFactory.getLogger( getClass() );
+
     // ----------------------------------------------------------------------
     // Configurables
     // ----------------------------------------------------------------------
@@ -446,14 +440,14 @@ public abstract class AbstractCompilerMojo
      * The current build session instance. This is used for toolchain manager 
API calls.
      */
     @Parameter( defaultValue = "${session}", readonly = true, required = true )
-    private MavenSession session;
+    private Session session;
 
     /**
      * The current project instance. This is used for propagating 
generated-sources paths as compile/testCompile source
      * roots.
      */
     @Parameter( defaultValue = "${project}", readonly = true, required = true )
-    private MavenProject project;
+    private Project project;
 
     /**
      * Strategy to re use javacc class created:
@@ -521,22 +515,15 @@ public abstract class AbstractCompilerMojo
     private boolean useIncrementalCompilation = true;
 
     /**
-     * Resolves the artifacts needed.
-     */
-    @Component
-    private RepositorySystem repositorySystem;
-
-    /**
-     * Artifact handler manager.
+     * Manages projects
      */
     @Component
-    private ArtifactHandlerManager artifactHandlerManager;
+    private ProjectManager projectManager;
 
-    /**
-     * Throws an exception on artifact resolution errors.
-     */
-    @Component
-    private ResolutionErrorHandler resolutionErrorHandler;
+    public ProjectManager getProjectManager()
+    {
+        return projectManager;
+    }
 
     protected abstract SourceInclusionScanner getSourceInclusionScanner( int 
staleMillis );
 
@@ -566,7 +553,7 @@ public abstract class AbstractCompilerMojo
 
     protected abstract File getGeneratedSourcesDirectory();
 
-    protected final MavenProject getProject()
+    protected final Project getProject()
     {
         return project;
     }
@@ -575,7 +562,7 @@ public abstract class AbstractCompilerMojo
 
     @Override
     public void execute()
-        throws MojoExecutionException, CompilationFailureException
+        throws MojoException, CompilationFailureException
     {
         // 
----------------------------------------------------------------------
         // Look up the compiler. This is done before other code than can
@@ -585,7 +572,7 @@ public abstract class AbstractCompilerMojo
 
         Compiler compiler;
 
-        getLog().debug( "Using compiler '" + compilerId + "'." );
+        logger.debug( "Using compiler '" + compilerId + "'." );
 
         try
         {
@@ -593,7 +580,7 @@ public abstract class AbstractCompilerMojo
         }
         catch ( NoSuchCompilerException e )
         {
-            throw new MojoExecutionException( "No such compiler '" + 
e.getCompilerId() + "'." );
+            throw new MojoException( "No such compiler '" + e.getCompilerId() 
+ "'." );
         }
 
         //-----------toolchains start here ----------------------------------
@@ -601,10 +588,10 @@ public abstract class AbstractCompilerMojo
         Toolchain tc = getToolchain();
         if ( tc != null )
         {
-            getLog().info( "Toolchain in maven-compiler-plugin: " + tc );
+            logger.info( "Toolchain in maven-compiler-plugin: " + tc );
             if ( executable != null )
             {
-                getLog().warn( "Toolchains are ignored, 'executable' parameter 
is set to " + executable );
+                logger.warn( "Toolchains are ignored, 'executable' parameter 
is set to " + executable );
             }
             else
             {
@@ -621,7 +608,7 @@ public abstract class AbstractCompilerMojo
 
         if ( compileSourceRoots.isEmpty() )
         {
-            getLog().info( "No sources to compile" );
+            logger.info( "No sources to compile" );
 
             return;
         }
@@ -635,7 +622,7 @@ public abstract class AbstractCompilerMojo
 
             writePlugin( mb );
 
-            getLog().warn( mb.toString() );
+            logger.warn( mb.toString() );
         }
 
         // 
----------------------------------------------------------------------
@@ -700,26 +687,26 @@ public abstract class AbstractCompilerMojo
 
             if ( isTestCompile() )
             {
-                getLog().debug( "Adding " + generatedSourcesPath + " to 
test-compile source roots:\n  "
-                                    + StringUtils.join( 
project.getTestCompileSourceRoots()
+                logger.debug( "Adding " + generatedSourcesPath + " to 
test-compile source roots:\n  "
+                                    + StringUtils.join( 
projectManager.getTestCompileSourceRoots( project )
                                                                .iterator(), 
"\n  " ) );
 
-                project.addTestCompileSourceRoot( generatedSourcesPath );
+                projectManager.addTestCompileSourceRoot( project, 
generatedSourcesPath );
 
-                getLog().debug( "New test-compile source roots:\n  "
-                                    + StringUtils.join( 
project.getTestCompileSourceRoots()
+                logger.debug( "New test-compile source roots:\n  "
+                                    + StringUtils.join( 
projectManager.getTestCompileSourceRoots( project )
                                                                .iterator(), 
"\n  " ) );
             }
             else
             {
-                getLog().debug( "Adding " + generatedSourcesPath + " to 
compile source roots:\n  "
-                                    + StringUtils.join( 
project.getCompileSourceRoots()
+                logger.debug( "Adding " + generatedSourcesPath + " to compile 
source roots:\n  "
+                                    + StringUtils.join( 
projectManager.getCompileSourceRoots( project )
                                                                .iterator(), 
"\n  " ) );
 
-                project.addCompileSourceRoot( generatedSourcesPath );
+                projectManager.addCompileSourceRoot( project, 
generatedSourcesPath );
 
-                getLog().debug( "New compile source roots:\n  " + 
StringUtils.join( project.getCompileSourceRoots()
-                                                                               
            .iterator(), "\n  " ) );
+                logger.debug( "New compile source roots:\n  " + 
StringUtils.join(
+                        projectManager.getCompileSourceRoots( project 
).iterator(), "\n  " ) );
             }
         }
 
@@ -745,7 +732,7 @@ public abstract class AbstractCompilerMojo
                 }
                 else
                 {
-                    getLog().info( "Invalid value for meminitial '" + 
meminitial + "'. Ignoring this option." );
+                    logger.info( "Invalid value for meminitial '" + meminitial 
+ "'. Ignoring this option." );
                 }
             }
 
@@ -759,7 +746,7 @@ public abstract class AbstractCompilerMojo
                 }
                 else
                 {
-                    getLog().info( "Invalid value for maxmem '" + maxmem + "'. 
Ignoring this option." );
+                    logger.info( "Invalid value for maxmem '" + maxmem + "'. 
Ignoring this option." );
                 }
             }
         }
@@ -785,7 +772,7 @@ public abstract class AbstractCompilerMojo
             {
                 if ( !skipMultiThreadWarning )
                 {
-                    getLog().warn( "You are in a multi-thread build and 
compilerReuseStrategy is set to reuseSame."
+                    logger.warn( "You are in a multi-thread build and 
compilerReuseStrategy is set to reuseSame."
                                        + " This can cause issues in some 
environments (os/jdk)!"
                                        + " Consider using reuseCreated 
strategy."
                                        + System.getProperty( "line.separator" )
@@ -802,13 +789,13 @@ public abstract class AbstractCompilerMojo
             compilerConfiguration.setCompilerReuseStrategy( 
CompilerConfiguration.CompilerReuseStrategy.ReuseCreated );
         }
 
-        getLog().debug( "CompilerReuseStrategy: " + 
compilerConfiguration.getCompilerReuseStrategy().getStrategy() );
+        logger.debug( "CompilerReuseStrategy: " + 
compilerConfiguration.getCompilerReuseStrategy().getStrategy() );
 
         compilerConfiguration.setForceJavacCompilerUse( forceJavacCompilerUse 
);
 
         boolean canUpdateTarget;
 
-        IncrementalBuildHelper incrementalBuildHelper = new 
IncrementalBuildHelper( mojoExecution, session );
+        IncrementalBuildHelper incrementalBuildHelper = new 
IncrementalBuildHelper( mojoExecution, project );
 
         final Set<File> sources;
 
@@ -816,7 +803,7 @@ public abstract class AbstractCompilerMojo
 
         if ( useIncrementalCompilation )
         {
-            getLog().debug( "useIncrementalCompilation enabled" );
+            logger.debug( "useIncrementalCompilation enabled" );
             try
             {
                 canUpdateTarget = compiler.canUpdateTarget( 
compilerConfiguration );
@@ -834,25 +821,25 @@ public abstract class AbstractCompilerMojo
                     || incrementalBuildHelper.inputFileTreeChanged( 
incrementalBuildHelperRequest ) )
                     // CHECKSTYLE_ON: LineLength
                 {
-                    getLog().info( "Changes detected - recompiling the 
module!" );
+                    logger.info( "Changes detected - recompiling the module!" 
);
 
                     compilerConfiguration.setSourceFiles( sources );
                 }
                 else
                 {
-                    getLog().info( "Nothing to compile - all classes are up to 
date" );
+                    logger.info( "Nothing to compile - all classes are up to 
date" );
 
                     return;
                 }
             }
             catch ( CompilerException e )
             {
-                throw new MojoExecutionException( "Error while computing stale 
sources.", e );
+                throw new MojoException( "Error while computing stale 
sources.", e );
             }
         }
         else
         {
-            getLog().debug( "useIncrementalCompilation disabled" );
+            logger.debug( "useIncrementalCompilation disabled" );
             
             Set<File> staleSources;
             try
@@ -865,7 +852,7 @@ public abstract class AbstractCompilerMojo
                 if ( compiler.getCompilerOutputStyle().equals( 
CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES )
                     && !canUpdateTarget )
                 {
-                    getLog().info( "RESCANNING!" );
+                    logger.info( "RESCANNING!" );
                     // TODO: This second scan for source files is sub-optimal
                     String inputFileEnding = compiler.getInputFileEnding( 
compilerConfiguration );
 
@@ -876,12 +863,12 @@ public abstract class AbstractCompilerMojo
             }
             catch ( CompilerException e )
             {
-                throw new MojoExecutionException( "Error while computing stale 
sources.", e );
+                throw new MojoException( "Error while computing stale 
sources.", e );
             }
 
             if ( staleSources.isEmpty() )
             {
-                getLog().info( "Nothing to compile - all classes are up to 
date" );
+                logger.info( "Nothing to compile - all classes are up to date" 
);
 
                 return;
             }
@@ -893,12 +880,12 @@ public abstract class AbstractCompilerMojo
                 // MCOMPILER-366: if sources contain the module-descriptor it 
must be used to define the modulepath
                 sources = getCompileSources( compiler, compilerConfiguration );
 
-                if ( getLog().isDebugEnabled() )
+                if ( logger.isDebugEnabled() )
                 {
-                    getLog().debug( "#sources: " + sources.size() );
+                    logger.debug( "#sources: " + sources.size() );
                     for ( File file : sources )
                     {
-                        getLog().debug( file.getPath() );
+                        logger.debug( file.getPath() );
                     }
                 }
 
@@ -906,7 +893,7 @@ public abstract class AbstractCompilerMojo
             }
             catch ( CompilerException e )
             {
-                throw new MojoExecutionException( "Error while computing stale 
sources.", e );
+                throw new MojoException( "Error while computing stale 
sources.", e );
             }
         }
        
@@ -959,29 +946,29 @@ public abstract class AbstractCompilerMojo
         // 
----------------------------------------------------------------------
         // Dump configuration
         // 
----------------------------------------------------------------------
-        if ( getLog().isDebugEnabled() )
+        if ( logger.isDebugEnabled() )
         {
-            getLog().debug( "Classpath:" );
+            logger.debug( "Classpath:" );
 
             for ( String s : getClasspathElements() )
             {
-                getLog().debug( " " + s );
+                logger.debug( " " + s );
             }
 
             if ( !getModulepathElements().isEmpty() )
             {
-                getLog().debug( "Modulepath:" );
+                logger.debug( "Modulepath:" );
                 for ( String s : getModulepathElements() )
                 {
-                    getLog().debug( " " + s );
+                    logger.debug( " " + s );
                 }
             }
 
-            getLog().debug( "Source roots:" );
+            logger.debug( "Source roots:" );
 
             for ( String root : getCompileSourceRoots() )
             {
-                getLog().debug( " " + root );
+                logger.debug( " " + root );
             }
 
             try
@@ -990,8 +977,8 @@ public abstract class AbstractCompilerMojo
                 {
                     if ( compilerConfiguration.getExecutable() != null )
                     {
-                        getLog().debug( "Excutable: " );
-                        getLog().debug( " " + 
compilerConfiguration.getExecutable() );
+                        logger.debug( "Excutable: " );
+                        logger.debug( " " + 
compilerConfiguration.getExecutable() );
                     }
                 }
 
@@ -1005,13 +992,13 @@ public abstract class AbstractCompilerMojo
                         sb.append( " " );
                         sb.append( cl[i] );
                     }
-                    getLog().debug( "Command line options:" );
-                    getLog().debug( sb );
+                    logger.debug( "Command line options:" );
+                    logger.debug( sb.toString() );
                 }
             }
             catch ( CompilerException ce )
             {
-                getLog().debug( ce );
+                logger.debug( ce.getMessage(), ce );
             }
         }
         
@@ -1095,7 +1082,7 @@ public abstract class AbstractCompilerMojo
                             }
                             else
                             {
-                                getLog().warn( "Can't locate " + file );
+                                logger.warn( "Can't locate " + file );
                             }
                         }
                         else if ( !values[0].equals( descriptor.name() ) )
@@ -1137,7 +1124,7 @@ public abstract class AbstractCompilerMojo
             }
             catch ( IOException e )
             {
-                getLog().warn( e.getMessage() );
+                logger.warn( e.getMessage() );
             }
         }
 
@@ -1148,7 +1135,7 @@ public abstract class AbstractCompilerMojo
 
         if ( StringUtils.isEmpty( compilerConfiguration.getSourceEncoding() ) )
         {
-            getLog().warn( "File encoding has not been set, using platform 
encoding " + ReaderFactory.FILE_ENCODING
+            logger.warn( "File encoding has not been set, using platform 
encoding " + ReaderFactory.FILE_ENCODING
                                + ", i.e. build is platform dependent!" );
         }
 
@@ -1161,7 +1148,7 @@ public abstract class AbstractCompilerMojo
 
             incrementalBuildHelper.beforeRebuildExecution( 
incrementalBuildHelperRequest );
 
-            getLog().debug( "incrementalBuildHelper#beforeRebuildExecution" );
+            logger.debug( "incrementalBuildHelper#beforeRebuildExecution" );
         }
 
         try
@@ -1179,20 +1166,20 @@ public abstract class AbstractCompilerMojo
         catch ( Exception e )
         {
             // TODO: don't catch Exception
-            throw new MojoExecutionException( "Fatal error compiling", e );
+            throw new MojoException( "Fatal error compiling", e );
         }
 
         if ( useIncrementalCompilation )
         {
             if ( incrementalBuildHelperRequest.getOutputDirectory().exists() )
             {
-                getLog().debug( "incrementalBuildHelper#afterRebuildExecution" 
);
+                logger.debug( "incrementalBuildHelper#afterRebuildExecution" );
                 // now scan the same directory again and create a diff
                 incrementalBuildHelper.afterRebuildExecution( 
incrementalBuildHelperRequest );
             }
             else
             {
-                getLog().debug(
+                logger.debug(
                     "skip incrementalBuildHelper#afterRebuildExecution as the 
output directory doesn't exist" );
             }
         }
@@ -1224,32 +1211,32 @@ public abstract class AbstractCompilerMojo
                 assert message.getKind() != CompilerMessage.Kind.ERROR
                     && message.getKind() != CompilerMessage.Kind.WARNING
                     && message.getKind() != 
CompilerMessage.Kind.MANDATORY_WARNING;
-                getLog().info( message.toString() );
+                logger.info( message.toString() );
             }
             if ( !warnings.isEmpty() )
             {
-                getLog().info( 
"-------------------------------------------------------------" );
-                getLog().warn( "COMPILATION WARNING : " );
-                getLog().info( 
"-------------------------------------------------------------" );
+                logger.info( 
"-------------------------------------------------------------" );
+                logger.warn( "COMPILATION WARNING : " );
+                logger.info( 
"-------------------------------------------------------------" );
                 for ( CompilerMessage warning : warnings )
                 {
-                    getLog().warn( warning.toString() );
+                    logger.warn( warning.toString() );
                 }
-                getLog().info( warnings.size() + ( ( warnings.size() > 1 ) ? " 
warnings " : " warning" ) );
-                getLog().info( 
"-------------------------------------------------------------" );
+                logger.info( warnings.size() + ( ( warnings.size() > 1 ) ? " 
warnings " : " warning" ) );
+                logger.info( 
"-------------------------------------------------------------" );
             }
 
             if ( !errors.isEmpty() )
             {
-                getLog().info( 
"-------------------------------------------------------------" );
-                getLog().error( "COMPILATION ERROR : " );
-                getLog().info( 
"-------------------------------------------------------------" );
+                logger.info( 
"-------------------------------------------------------------" );
+                logger.error( "COMPILATION ERROR : " );
+                logger.info( 
"-------------------------------------------------------------" );
                 for ( CompilerMessage error : errors )
                 {
-                    getLog().error( error.toString() );
+                    logger.error( error.toString() );
                 }
-                getLog().info( errors.size() + ( ( errors.size() > 1 ) ? " 
errors " : " error" ) );
-                getLog().info( 
"-------------------------------------------------------------" );
+                logger.info( errors.size() + ( ( errors.size() > 1 ) ? " 
errors " : " error" ) );
+                logger.info( 
"-------------------------------------------------------------" );
             }
 
             if ( !errors.isEmpty() )
@@ -1269,17 +1256,17 @@ public abstract class AbstractCompilerMojo
                 {
                     case NOTE:
                     case OTHER:
-                        getLog().info( message.toString() );
+                        logger.info( message.toString() );
                         break;
 
                     case ERROR:
-                        getLog().error( message.toString() );
+                        logger.error( message.toString() );
                         break;
 
                     case MANDATORY_WARNING:
                     case WARNING:
                     default:
-                        getLog().warn( message.toString() );
+                        logger.warn( message.toString() );
                         break;
                 }
             }
@@ -1318,7 +1305,7 @@ public abstract class AbstractCompilerMojo
      * @return all source files for the compiler
      */
     private Set<File> getCompileSources( Compiler compiler, 
CompilerConfiguration compilerConfiguration )
-        throws MojoExecutionException, CompilerException
+        throws MojoException, CompilerException
     {
         String inputFileEnding = compiler.getInputFileEnding( 
compilerConfiguration );
         if ( StringUtils.isEmpty( inputFileEnding ) )
@@ -1351,7 +1338,7 @@ public abstract class AbstractCompilerMojo
             }
             catch ( InclusionScanException e )
             {
-                throw new MojoExecutionException(
+                throw new MojoException(
                     "Error scanning source root: \'" + sourceRoot + "\' for 
stale files to recompile.", e );
             }
         }
@@ -1365,16 +1352,16 @@ public abstract class AbstractCompilerMojo
      * @return <code>true</code> if at least a single source file is newer 
than it's class file
      */
     private boolean isSourceChanged( CompilerConfiguration 
compilerConfiguration, Compiler compiler )
-        throws CompilerException, MojoExecutionException
+        throws CompilerException, MojoException
     {
         Set<File> staleSources =
             computeStaleSources( compilerConfiguration, compiler, 
getSourceInclusionScanner( staleMillis ) );
 
-        if ( getLog().isDebugEnabled() )
+        if ( logger.isDebugEnabled() )
         {
             for ( File f : staleSources )
             {
-                getLog().debug( "Stale source detected: " + 
f.getAbsolutePath() );
+                logger.debug( "Stale source detected: " + f.getAbsolutePath() 
);
             }
         }
         return !staleSources.isEmpty();
@@ -1398,7 +1385,7 @@ public abstract class AbstractCompilerMojo
         }
         catch ( Exception e )
         {
-            getLog().debug( "unable to get threadCount for the current build: 
" + e.getMessage() );
+            logger.debug( "unable to get threadCount for the current build: " 
+ e.getMessage() );
         }
         return 1;
     }
@@ -1415,7 +1402,7 @@ public abstract class AbstractCompilerMojo
         }
         catch ( Exception e )
         {
-            getLog().debug( "unable to get start time for the current build: " 
+ e.getMessage() );
+            logger.debug( "unable to get start time for the current build: " + 
e.getMessage() );
         }
 
         if ( buildStartTime == null )
@@ -1452,33 +1439,16 @@ public abstract class AbstractCompilerMojo
         
         if ( jdkToolchain != null )
         {
-            // Maven 3.3.1 has plugin execution scoped Toolchain Support
-            try
-            {
-                Method getToolchainsMethod =
-                    toolchainManager.getClass().getMethod( "getToolchains", 
MavenSession.class, String.class,
-                                                           Map.class );
-
-                @SuppressWarnings( "unchecked" )
-                List<Toolchain> tcs =
-                    (List<Toolchain>) getToolchainsMethod.invoke( 
toolchainManager, session, "jdk",
-                                                                  jdkToolchain 
);
-
-                if ( tcs != null && !tcs.isEmpty() )
-                {
-                    tc = tcs.get( 0 );
-                }
-            }
-            catch ( NoSuchMethodException | SecurityException | 
IllegalAccessException | IllegalArgumentException
-                | InvocationTargetException e )
+            List<Toolchain> tcs = toolchainManager.getToolchains( session, 
"jdk", jdkToolchain );
+            if ( tcs != null && !tcs.isEmpty() )
             {
-                // ignore
+                tc = tcs.get( 0 );
             }
         }
         
         if ( tc == null )
         {
-            tc = toolchainManager.getToolchainFromBuildContext( "jdk", session 
);
+            tc = toolchainManager.getToolchainFromBuildContext( session, "jdk" 
);
         }
         
         return tc;
@@ -1498,7 +1468,7 @@ public abstract class AbstractCompilerMojo
 
     private Set<File> computeStaleSources( CompilerConfiguration 
compilerConfiguration, Compiler compiler,
                                            SourceInclusionScanner scanner )
-        throws MojoExecutionException, CompilerException
+        throws MojoException, CompilerException
     {
         SourceMapping mapping = getSourceMapping( compilerConfiguration, 
compiler );
 
@@ -1532,7 +1502,7 @@ public abstract class AbstractCompilerMojo
             }
             catch ( InclusionScanException e )
             {
-                throw new MojoExecutionException(
+                throw new MojoException(
                     "Error scanning source root: \'" + sourceRoot + "\' for 
stale files to recompile.", e );
             }
         }
@@ -1541,7 +1511,7 @@ public abstract class AbstractCompilerMojo
     }
 
     private SourceMapping getSourceMapping( CompilerConfiguration 
compilerConfiguration, Compiler compiler )
-        throws CompilerException, MojoExecutionException
+        throws CompilerException, MojoException
     {
         CompilerOutputStyle outputStyle = compiler.getCompilerOutputStyle();
 
@@ -1559,7 +1529,7 @@ public abstract class AbstractCompilerMojo
         }
         else
         {
-            throw new MojoExecutionException( "Unknown compiler output style: 
'" + outputStyle + "'." );
+            throw new MojoException( "Unknown compiler output style: '" + 
outputStyle + "'." );
         }
         return mapping;
     }
@@ -1597,7 +1567,7 @@ public abstract class AbstractCompilerMojo
         if ( session == null )
         {
             // we just cannot determine it, so don't do anything beside logging
-            getLog().info( "Cannot determine build start date, skipping 
incremental build detection." );
+            logger.info( "Cannot determine build start date, skipping 
incremental build detection." );
             return false;
         }
 
@@ -1621,7 +1591,7 @@ public abstract class AbstractCompilerMojo
             {
                 if ( hasNewFile( artifactPath, buildStartTime ) )
                 {
-                    getLog().debug( "New dependency detected: " + 
artifactPath.getAbsolutePath() );
+                    logger.debug( "New dependency detected: " + 
artifactPath.getAbsolutePath() );
                     return true;
                 }
             }
@@ -1663,7 +1633,7 @@ public abstract class AbstractCompilerMojo
     }
 
     private List<String> resolveProcessorPathEntries()
-        throws MojoExecutionException
+        throws MojoException
     {
         if ( annotationProcessorPaths == null || 
annotationProcessorPaths.isEmpty() )
         {
@@ -1672,42 +1642,23 @@ public abstract class AbstractCompilerMojo
 
         try
         {
-            Set<String> elements = new LinkedHashSet<>();
-            for ( DependencyCoordinate coord : annotationProcessorPaths )
-            {
-                ArtifactHandler handler = 
artifactHandlerManager.getArtifactHandler( coord.getType() );
-
-                Artifact artifact = new DefaultArtifact(
-                     coord.getGroupId(),
-                     coord.getArtifactId(),
-                     VersionRange.createFromVersionSpec( coord.getVersion() ),
-                     Artifact.SCOPE_RUNTIME,
-                     coord.getType(),
-                     coord.getClassifier(),
-                     handler,
-                     false );
-
-                ArtifactResolutionRequest request = new 
ArtifactResolutionRequest()
-                                .setArtifact( artifact )
-                                .setResolveRoot( true )
-                                .setResolveTransitively( true )
-                                .setLocalRepository( 
session.getLocalRepository() )
-                                .setRemoteRepositories( 
project.getRemoteArtifactRepositories() );
-
-                ArtifactResolutionResult resolutionResult = 
repositorySystem.resolve( request );
-
-                resolutionErrorHandler.throwErrors( request, resolutionResult 
);
-
-                for ( Artifact resolved : resolutionResult.getArtifacts() )
-                {
-                    elements.add( resolved.getFile().getAbsolutePath() );
-                }
-            }
-            return new ArrayList<>( elements );
+            return annotationProcessorPaths.stream()
+                    .map( coord -> session.createArtifact( coord.getGroupId(), 
coord.getArtifactId(),
+                            coord.getClassifier(), coord.getVersion(), 
coord.getType() ) )
+                    .map( artifact -> session.createDependency( artifact ) )
+                    .map( dependency -> session
+                            .withRemoteRepositories( 
projectManager.getRepositories( project ) )
+                            .resolveDependencies( dependency ) )
+                    .flatMap( res -> res.getArtifactResults().stream() )
+                    .map( res -> res.getArtifact().getPath() )
+                    .filter( Optional::isPresent )
+                    .map( o -> o.get().toAbsolutePath().toString() )
+                    .distinct()
+                    .collect( Collectors.toList() );
         }
         catch ( Exception e )
         {
-            throw new MojoExecutionException( "Resolution of 
annotationProcessorPath dependencies failed: "
+            throw new MojoException( "Resolution of annotationProcessorPath 
dependencies failed: "
                 + e.getLocalizedMessage(), e );
         }
     }
diff --git 
a/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java
 
b/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java
index 4d62454..8963130 100644
--- 
a/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java
+++ 
b/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java
@@ -19,7 +19,7 @@ package org.apache.maven.plugin.compiler;
  * under the License.
  */
 
-import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.api.plugin.MojoException;
 import org.codehaus.plexus.compiler.CompilerMessage;
 
 import java.util.List;
@@ -30,7 +30,7 @@ import java.util.List;
  */
 @SuppressWarnings( "serial" )
 public class CompilationFailureException
-    extends MojoFailureException
+        extends MojoException
 {
     private static final String LS = System.getProperty( "line.separator" );
 
diff --git a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java 
b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
index 7cb94f2..dc6b19c 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
@@ -31,17 +31,20 @@ import java.util.Map;
 import java.util.Set;
 import java.util.Map.Entry;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.JavaToolchain;
+import org.apache.maven.api.Project;
+import org.apache.maven.api.Toolchain;
+import org.apache.maven.api.plugin.MojoException;
+import org.apache.maven.api.plugin.annotations.Component;
+import org.apache.maven.api.plugin.annotations.LifecyclePhase;
+import org.apache.maven.api.plugin.annotations.Mojo;
+import org.apache.maven.api.plugin.annotations.Parameter;
+import org.apache.maven.api.plugin.annotations.ResolutionScope;
+import org.apache.maven.api.services.ArtifactManager;
+import org.apache.maven.api.services.ProjectManager;
 import org.apache.maven.shared.utils.StringUtils;
 import org.apache.maven.shared.utils.logging.MessageUtils;
-import org.apache.maven.toolchain.Toolchain;
-import org.apache.maven.toolchain.java.DefaultJavaToolChain;
 import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
 import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
 import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
@@ -57,8 +60,8 @@ import 
org.codehaus.plexus.languages.java.jpms.ResolvePathsResult;
  * @author <a href="mailto:[email protected]";>Jason van Zyl </a>
  * @since 2.0
  */
-@Mojo( name = "compile", defaultPhase = LifecyclePhase.COMPILE, threadSafe = 
true, 
-    requiresDependencyResolution = ResolutionScope.COMPILE )
+@Mojo( name = "compile", defaultPhase = LifecyclePhase.COMPILE,
+       requiresDependencyResolution = ResolutionScope.COMPILE )
 public class CompilerMojo
     extends AbstractCompilerMojo
 {
@@ -129,6 +132,9 @@ public class CompilerMojo
     @Parameter
     private boolean multiReleaseOutput;
 
+    @Component
+    private ArtifactManager artifactManager;
+
     final LocationManager locationManager = new LocationManager();
 
     private List<String> classpathElements;
@@ -175,24 +181,24 @@ public class CompilerMojo
     }
 
     public void execute()
-        throws MojoExecutionException, CompilationFailureException
+        throws MojoException, CompilationFailureException
     {
         if ( skipMain )
         {
-            getLog().info( "Not compiling main sources" );
+            logger.info( "Not compiling main sources" );
             return;
         }
         
         if ( multiReleaseOutput && release == null )
         {
-            throw new MojoExecutionException( "When using 'multiReleaseOutput' 
the release must be set" );
+            throw new MojoException( "When using 'multiReleaseOutput' the 
release must be set" );
         }
 
         super.execute();
 
         if ( outputDirectory.isDirectory() )
         {
-            projectArtifact.setFile( outputDirectory );
+            artifactManager.setPath( projectArtifact, outputDirectory.toPath() 
);
         }
     }
 
@@ -234,9 +240,9 @@ public class CompilerMojo
                                        .setMainModuleDescriptor( 
moduleDescriptorPath );
                 
                 Toolchain toolchain = getToolchain();
-                if ( toolchain instanceof DefaultJavaToolChain )
+                if ( toolchain instanceof JavaToolchain )
                 {
-                    request.setJdkHome( new File( ( (DefaultJavaToolChain) 
toolchain ).getJavaHome() ) );
+                    request.setJdkHome( new File( ( (JavaToolchain) toolchain 
).getJavaHome() ) );
                 }
 
                 resolvePathsResult = locationManager.resolvePaths( request );
@@ -249,7 +255,7 @@ public class CompilerMojo
                         cause = cause.getCause();
                     }
                     String fileName = pathException.getKey().getName();
-                    getLog().warn( "Can't extract module name from " + 
fileName + ": " + cause.getMessage() );
+                    logger.warn( "Can't extract module name from " + fileName 
+ ": " + cause.getMessage() );
                 }
                 
                 JavaModuleDescriptor moduleDescriptor = 
resolvePathsResult.getMainModuleDescriptor();
@@ -291,7 +297,7 @@ public class CompilerMojo
             }
             catch ( IOException e )
             {
-                getLog().warn( e.getMessage() );
+                logger.warn( e.getMessage() );
             }
         }
         else
@@ -326,7 +332,7 @@ public class CompilerMojo
             if ( moduleDescriptor.exports().isEmpty() )
             {
                 // application
-                getLog().info( message );
+                logger.info( message );
             }
             else
             {
@@ -336,14 +342,16 @@ public class CompilerMojo
         }
     }
     
-    private List<File> getCompileClasspathElements( MavenProject project )
+    private List<File> getCompileClasspathElements( Project project )
     {
-        // 3 is outputFolder + 2 preserved for multirelease  
-        List<File> list = new ArrayList<>( project.getArtifacts().size() + 3 );
+        // 3 is outputFolder + 2 preserved for multirelease
+        List<Artifact> artifacts = getProjectManager().getResolvedDependencies(
+                project, ProjectManager.ResolutionScope.Compile );
+        List<File> list = new ArrayList<>( artifacts.size() + 3 );
 
         if ( multiReleaseOutput )
         {
-            File versionsFolder = new File( 
project.getBuild().getOutputDirectory(), "META-INF/versions" );
+            File versionsFolder = new File( 
project.getModel().getBuild().getOutputDirectory(), "META-INF/versions" );
             
             // in reverse order
             for ( int version = Integer.parseInt( getRelease() ) - 1; version 
>= 9 ; version-- )
@@ -356,11 +364,11 @@ public class CompilerMojo
             }
         }
 
-        list.add( new File( project.getBuild().getOutputDirectory() ) );
+        list.add( new File( project.getModel().getBuild().getOutputDirectory() 
) );
 
-        for ( Artifact a : project.getArtifacts() )
+        for ( Artifact a : artifacts )
         {
-            list.add( a.getFile() );
+            list.add( a.getPath().get().toFile() );
         }
         return list;
     }
@@ -427,8 +435,8 @@ public class CompilerMojo
     private void writeBoxedWarning( String message )
     {
         String line = StringUtils.repeat( "*", message.length() + 4 );
-        getLog().warn( line );
-        getLog().warn( "* " + MessageUtils.buffer().strong( message )  + " *" 
);
-        getLog().warn( line );
+        logger.warn( line );
+        logger.warn( "* " + MessageUtils.buffer().strong( message )  + " *" );
+        logger.warn( line );
     }
 }
diff --git 
a/src/main/java/org/apache/maven/plugin/compiler/IncrementalBuildHelper.java 
b/src/main/java/org/apache/maven/plugin/compiler/IncrementalBuildHelper.java
new file mode 100644
index 0000000..9732574
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugin/compiler/IncrementalBuildHelper.java
@@ -0,0 +1,362 @@
+package org.apache.maven.plugin.compiler;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Set;
+
+import org.apache.maven.api.MojoExecution;
+import org.apache.maven.api.Project;
+import org.apache.maven.api.plugin.MojoException;
+import org.apache.maven.shared.utils.io.DirectoryScanResult;
+import org.apache.maven.shared.utils.io.DirectoryScanner;
+import org.apache.maven.shared.utils.io.FileUtils;
+
+/**
+ * Various helper methods to support incremental builds
+ */
+public class IncrementalBuildHelper
+{
+    /**
+     * the root directory to store status information about Maven executions 
in.
+     */
+    private static final String MAVEN_STATUS_ROOT = "maven-status";
+    public static final String CREATED_FILES_LST_FILENAME = "createdFiles.lst";
+    private static final String INPUT_FILES_LST_FILENAME = "inputFiles.lst";
+
+    private static final String[] EMPTY_ARRAY = new String[0];
+
+    /**
+     * Needed for storing the status for the incremental build support.
+     */
+    private MojoExecution mojoExecution;
+
+    /**
+     * Needed for storing the status for the incremental build support.
+     */
+    private Project mavenProject;
+
+    /**
+     * Used for detecting changes between the Mojo execution.
+     * @see #getDirectoryScanner();
+     */
+    private DirectoryScanner directoryScanner;
+
+    /**
+     * Once the {@link #beforeRebuildExecution(IncrementalBuildHelperRequest)} 
got
+     * called, this will contain the list of files in the build directory.
+     */
+    private String[] filesBeforeAction = new String[0];
+
+    public IncrementalBuildHelper( MojoExecution mojoExecution, Project 
mavenProject )
+    {
+        if ( mavenProject == null )
+        {
+            throw new IllegalArgumentException( "MavenProject must not be 
null!" );
+        }
+        if ( mojoExecution == null )
+        {
+            throw new IllegalArgumentException( "MojoExecution must not be 
null!" );
+        }
+
+        this.mavenProject = mavenProject;
+        this.mojoExecution = mojoExecution;
+    }
+
+    /**
+     * Get the existing DirectoryScanner used by this helper,
+     * or create new a DirectoryScanner if none is yet set.
+     * The DirectoryScanner is used for detecting changes in a directory
+     */
+    public DirectoryScanner getDirectoryScanner()
+    {
+        if ( directoryScanner == null )
+        {
+            directoryScanner = new DirectoryScanner();
+        }
+
+        return directoryScanner;
+    }
+
+    /**
+     * Set the DirectoryScanner which shall get used by this build helper.
+     * @param directoryScanner
+     */
+    public void setDirectoryScanner( DirectoryScanner directoryScanner )
+    {
+        this.directoryScanner = directoryScanner;
+    }
+
+    /**
+     * We use a specific status directory for each Mojo execution to store 
state
+     * which is needed during the next build invocation run.
+     * @return the directory for storing status information of the current 
Mojo execution.
+     */
+    public File getMojoStatusDirectory()
+        throws MojoException
+    {
+        if ( mojoExecution == null )
+        {
+            throw new MojoException( "MojoExecution could not get resolved" );
+        }
+
+        File buildOutputDirectory = new File( 
mavenProject.getModel().getBuild().getDirectory() );
+
+        //X TODO the executionId contains -cli and -mojoname
+        //X we should remove those postfixes as it should not make
+        //X any difference whether being run on the cli or via build
+        String mojoStatusPath =
+            MAVEN_STATUS_ROOT + File.separator
+                + mojoExecution.getPlugin().getArtifactId() + File.separator
+                + mojoExecution.getGoal() + File.separator + 
mojoExecution.getExecutionId();
+
+        File mojoStatusDir = new File( buildOutputDirectory, mojoStatusPath );
+
+        if ( !mojoStatusDir.exists() )
+        {
+            mojoStatusDir.mkdirs();
+        }
+
+        return mojoStatusDir;
+    }
+
+    /**
+     * Detect whether the list of detected files has changed since the last 
build.
+     * We simply load the list of files for the previous build from a status 
file
+     * and compare it with the new list. Afterwards we store the new list in 
the status file.
+     *
+     * @param incrementalBuildHelperRequest
+     * @return <code>true</code> if the set of inputFiles got changed since 
the last build.
+     * @throws MojoException
+     */
+    public boolean inputFileTreeChanged( IncrementalBuildHelperRequest 
incrementalBuildHelperRequest )
+        throws MojoException
+    {
+        File mojoConfigBase = getMojoStatusDirectory();
+        File mojoConfigFile = new File( mojoConfigBase, 
INPUT_FILES_LST_FILENAME );
+
+        String[] oldInputFiles = new String[0];
+
+        if ( mojoConfigFile.exists() )
+        {
+            try
+            {
+                oldInputFiles = FileUtils.fileReadArray( mojoConfigFile );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoException( "Error reading old mojo status " + 
mojoConfigFile, e );
+            }
+        }
+
+        String[] inputFileNames = new 
String[incrementalBuildHelperRequest.getInputFiles().size()];
+        int i = 0;
+        for ( File inputFile : incrementalBuildHelperRequest.getInputFiles() )
+        {
+            inputFileNames[i++] = inputFile.getAbsolutePath();
+        }
+
+        DirectoryScanResult dsr = DirectoryScanner.diffFiles( oldInputFiles, 
inputFileNames );
+
+        try
+        {
+            FileUtils.fileWriteArray( mojoConfigFile, inputFileNames );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoException( "Error while storing the mojo status", e 
);
+        }
+
+        return ( dsr.getFilesAdded().length > 0 || 
dsr.getFilesRemoved().length > 0 );
+    }
+
+    /**
+     * Detect whether the list of detected files picked up by the 
DirectoryScanner
+     * has changed since the last build.
+     * We simply load the list of files for the previous build from a status 
file
+     * and compare it with the result of the new DirectoryScanner#scan().
+     * Afterwards we store the new list in the status file.
+     *
+     * @param dirScanner
+     * @return <code>true</code> if the set of inputFiles got changed since 
the last build.
+     * @throws MojoException
+     */
+    public boolean inputFileTreeChanged( DirectoryScanner dirScanner )
+        throws MojoException
+    {
+        File mojoConfigBase = getMojoStatusDirectory();
+        File mojoConfigFile = new File( mojoConfigBase, 
INPUT_FILES_LST_FILENAME );
+
+        String[] oldInputFiles = new String[0];
+
+        if ( mojoConfigFile.exists() )
+        {
+            try
+            {
+                oldInputFiles = FileUtils.fileReadArray( mojoConfigFile );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoException( "Error reading old mojo status " + 
mojoConfigFile, e );
+            }
+        }
+
+        dirScanner.scan();
+
+        try
+        {
+            // store away the list of input files
+            FileUtils.fileWriteArray( mojoConfigFile, 
dirScanner.getIncludedFiles() );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoException( "Error while storing new mojo status" + 
mojoConfigFile, e );
+        }
+
+        DirectoryScanResult dsr = dirScanner.diffIncludedFiles( oldInputFiles 
);
+
+        return ( dsr.getFilesAdded().length > 0 || 
dsr.getFilesRemoved().length > 0 );
+    }
+
+    /**
+     * <p>
+     * This method shall get invoked before the actual Mojo task gets 
triggered, e.g. the actual compile in
+     * maven-compiler-plugin.
+     * </p>
+     * <p>
+     * <b>Attention:</b> This method shall only get invoked if the plugin 
re-creates <b>all</b> the output.
+     * </p>
+     * <p>
+     * It first picks up the list of files created in the previous build and 
delete them. This step is necessary to
+     * prevent left-overs. After that we take a 'directory snapshot' (list of 
all files which exist in the
+     * outputDirectory after the clean).
+     * </p>
+     * <p>
+     * After the actual Mojo task got executed you should invoke the method
+     * {@link #afterRebuildExecution(IncrementalBuildHelperRequest)} to 
collect the
+     * list of files which got changed by this task.
+     * </p>
+     *
+     * @param incrementalBuildHelperRequest
+     * @return all files which got created in the previous build and have been 
deleted now.
+     * @throws MojoException
+     */
+    public String[] beforeRebuildExecution( IncrementalBuildHelperRequest 
incrementalBuildHelperRequest )
+        throws MojoException
+    {
+        File mojoConfigBase = getMojoStatusDirectory();
+        File mojoConfigFile = new File( mojoConfigBase, 
CREATED_FILES_LST_FILENAME );
+
+        String[] oldFiles;
+
+        try
+        {
+            oldFiles = FileUtils.fileReadArray( mojoConfigFile );
+            for ( String oldFileName : oldFiles )
+            {
+                File oldFile = new File( 
incrementalBuildHelperRequest.getOutputDirectory(), oldFileName );
+                oldFile.delete();
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new MojoException( "Error reading old mojo status", e );
+        }
+
+        // we remember all files which currently exist in the output directory
+        DirectoryScanner diffScanner = getDirectoryScanner();
+        diffScanner.setBasedir( 
incrementalBuildHelperRequest.getOutputDirectory() );
+        if ( incrementalBuildHelperRequest.getOutputDirectory().exists() )
+        {
+            diffScanner.scan();
+            filesBeforeAction = diffScanner.getIncludedFiles();
+        }
+
+        return oldFiles;
+    }
+
+    /**
+     * <p>This method collects and stores all information about files changed 
since the
+     * call to {@link 
#beforeRebuildExecution(IncrementalBuildHelperRequest)}.</p>
+     *
+     * <p><b>Attention:</b> This method shall only get invoked if the plugin 
re-creates <b>all</b> the output.</p>
+     *
+     * @param incrementalBuildHelperRequest will contains file sources to 
store if create files are not yet stored
+     *
+     * @throws MojoException
+     */
+    public void afterRebuildExecution( IncrementalBuildHelperRequest 
incrementalBuildHelperRequest )
+        throws MojoException
+    {
+        DirectoryScanner diffScanner = getDirectoryScanner();
+        // now scan the same directory again and create a diff
+        diffScanner.scan();
+        DirectoryScanResult scanResult = diffScanner.diffIncludedFiles( 
filesBeforeAction );
+
+        File mojoConfigBase = getMojoStatusDirectory();
+        File mojoConfigFile = new File( mojoConfigBase, 
CREATED_FILES_LST_FILENAME );
+
+        try
+        {
+            FileUtils.fileWriteArray( mojoConfigFile, 
scanResult.getFilesAdded() );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoException( "Error while storing the mojo status", e 
);
+        }
+
+        // in case of clean compile the file is not created so next compile 
won't see it
+        // we mus create it here
+        mojoConfigFile = new File( mojoConfigBase, INPUT_FILES_LST_FILENAME );
+        if ( !mojoConfigFile.exists() )
+        {
+            try
+            {
+                FileUtils.fileWriteArray( mojoConfigFile,
+                                          toArrayOfPath( 
incrementalBuildHelperRequest.getInputFiles() ) );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoException( "Error while storing the mojo 
status", e );
+            }
+        }
+
+    }
+
+    private String[] toArrayOfPath( Set<File> files )
+    {
+        if ( files == null || files.isEmpty() )
+        {
+            return EMPTY_ARRAY;
+        }
+        String[] paths = new String[files.size()];
+
+        int i = 0;
+
+        for ( File file : files )
+        {
+            paths[i] = file.getPath();
+            i++;
+        }
+
+        return paths;
+    }
+}
diff --git 
a/src/main/java/org/apache/maven/plugin/compiler/IncrementalBuildHelperRequest.java
 
b/src/main/java/org/apache/maven/plugin/compiler/IncrementalBuildHelperRequest.java
new file mode 100644
index 0000000..3e2c720
--- /dev/null
+++ 
b/src/main/java/org/apache/maven/plugin/compiler/IncrementalBuildHelperRequest.java
@@ -0,0 +1,76 @@
+package org.apache.maven.plugin.compiler;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.1
+ */
+public class IncrementalBuildHelperRequest
+{
+    private Set<File> inputFiles;
+
+    private File outputDirectory;
+
+    public IncrementalBuildHelperRequest()
+    {
+        // no op
+    }
+
+    public Set<File> getInputFiles()
+    {
+        if ( inputFiles == null )
+        {
+            this.inputFiles = new HashSet<File>();
+        }
+        return inputFiles;
+    }
+
+    public void setInputFiles( Set<File> inputFiles )
+    {
+        this.inputFiles = inputFiles;
+    }
+
+    public IncrementalBuildHelperRequest inputFiles( Set<File> inputFiles )
+    {
+        this.inputFiles = inputFiles;
+        return this;
+    }
+
+    public File getOutputDirectory()
+    {
+        return outputDirectory;
+    }
+
+    public void setOutputDirectory( File outputDirectory )
+    {
+        this.outputDirectory = outputDirectory;
+    }
+
+    public IncrementalBuildHelperRequest outputDirectory( File outputDirectory 
)
+    {
+        this.outputDirectory = outputDirectory;
+        return this;
+    }
+}
diff --git 
a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java 
b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
index 9430ac2..55628e6 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
@@ -33,13 +33,13 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.toolchain.Toolchain;
-import org.apache.maven.toolchain.java.DefaultJavaToolChain;
+import org.apache.maven.api.JavaToolchain;
+import org.apache.maven.api.Toolchain;
+import org.apache.maven.api.plugin.MojoException;
+import org.apache.maven.api.plugin.annotations.LifecyclePhase;
+import org.apache.maven.api.plugin.annotations.Mojo;
+import org.apache.maven.api.plugin.annotations.Parameter;
+import org.apache.maven.api.plugin.annotations.ResolutionScope;
 import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
 import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
 import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
@@ -54,8 +54,8 @@ import 
org.codehaus.plexus.languages.java.jpms.ResolvePathsResult;
  * @author <a href="mailto:[email protected]";>Jason van Zyl</a>
  * @since 2.0
  */
-@Mojo( name = "testCompile", defaultPhase = LifecyclePhase.TEST_COMPILE, 
threadSafe = true,
-                requiresDependencyResolution = ResolutionScope.TEST )
+@Mojo( name = "testCompile", defaultPhase = LifecyclePhase.TEST_COMPILE,
+       requiresDependencyResolution = ResolutionScope.TEST )
 public class TestCompilerMojo
     extends AbstractCompilerMojo
 {
@@ -111,7 +111,7 @@ public class TestCompilerMojo
      * 
      * @since 3.6
      */
-    @Parameter ( property = "maven.compiler.testRelease" )
+    @Parameter( property = "maven.compiler.testRelease" )
     private String testRelease;
 
     /**
@@ -165,11 +165,11 @@ public class TestCompilerMojo
     private Collection<String> modulepathElements;
 
     public void execute()
-        throws MojoExecutionException, CompilationFailureException
+        throws MojoException, CompilationFailureException
     {
         if ( skip )
         {
-            getLog().info( "Not compiling test sources" );
+            logger.info( "Not compiling test sources" );
             return;
         }
         super.execute();
@@ -205,7 +205,7 @@ public class TestCompilerMojo
     @Override
     protected void preparePaths( Set<File> sourceFiles )
     {
-        File mainOutputDirectory = new File( 
getProject().getBuild().getOutputDirectory() );
+        File mainOutputDirectory = new File( 
getProject().getModel().getBuild().getOutputDirectory() );
 
         File mainModuleDescriptorClassFile = new File( mainOutputDirectory, 
"module-info.class" );
         JavaModuleDescriptor mainModuleDescriptor = null;
@@ -236,9 +236,9 @@ public class TestCompilerMojo
                                 .setMainModuleDescriptor( 
mainModuleDescriptorClassFile.getAbsolutePath() );
 
                 Toolchain toolchain = getToolchain();
-                if ( toolchain instanceof DefaultJavaToolChain )
+                if ( toolchain instanceof JavaToolchain )
                 {
-                    request.setJdkHome( ( (DefaultJavaToolChain) toolchain 
).getJavaHome() );
+                    request.setJdkHome( ( (JavaToolchain) toolchain 
).getJavaHome() );
                 }
 
                 result = locationManager.resolvePaths( request );
@@ -251,7 +251,7 @@ public class TestCompilerMojo
                         cause = cause.getCause();
                     }
                     String fileName = Paths.get( pathException.getKey() 
).getFileName().toString();
-                    getLog().warn( "Can't extract module name from " + 
fileName + ": " + cause.getMessage() );
+                    logger.warn( "Can't extract module name from " + fileName 
+ ": " + cause.getMessage() );
                 }
             }
             catch ( IOException e )
@@ -280,9 +280,9 @@ public class TestCompilerMojo
                                 .setMainModuleDescriptor( 
testModuleDescriptorJavaFile.getAbsolutePath() );
 
                 Toolchain toolchain = getToolchain();
-                if ( toolchain instanceof DefaultJavaToolChain )
+                if ( toolchain instanceof JavaToolchain )
                 {
-                    request.setJdkHome( ( (DefaultJavaToolChain) toolchain 
).getJavaHome() );
+                    request.setJdkHome( ( (JavaToolchain) toolchain 
).getJavaHome() );
                 }
 
                 result = locationManager.resolvePaths( request );
@@ -320,11 +320,11 @@ public class TestCompilerMojo
 
             if ( mainModuleDescriptor != null )
             {
-                if ( getLog().isDebugEnabled() )
+                if ( logger.isDebugEnabled() )
                 {
-                    getLog().debug( "Main and test module descriptors exist:" 
);
-                    getLog().debug( "  main module = " + 
mainModuleDescriptor.name() );
-                    getLog().debug( "  test module = " + 
testModuleDescriptor.name() );
+                    logger.debug( "Main and test module descriptors exist:" );
+                    logger.debug( "  main module = " + 
mainModuleDescriptor.name() );
+                    logger.debug( "  test module = " + 
testModuleDescriptor.name() );
                 }
 
                 if ( testModuleDescriptor.name().equals( 
mainModuleDescriptor.name() ) )
@@ -339,7 +339,7 @@ public class TestCompilerMojo
                     patchModuleValue.append( testModuleDescriptor.name() );
                     patchModuleValue.append( '=' );
 
-                    for ( String root : getProject().getCompileSourceRoots() )
+                    for ( String root : 
getProjectManager().getCompileSourceRoots( getProject() ) )
                     {
                         if ( Files.exists( Paths.get( root ) ) )
                         {
@@ -351,7 +351,7 @@ public class TestCompilerMojo
                 }
                 else
                 {
-                    getLog().debug( "Black-box testing - all is ready to 
compile" );
+                    logger.debug( "Black-box testing - all is ready to 
compile" );
                 }
             }
             else
diff --git 
a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java 
b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
index 79d8711..55d89f0 100644
--- a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
+++ b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
@@ -47,6 +47,8 @@ import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.languages.java.version.JavaVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class CompilerMojoTestCase
     extends AbstractMojoTestCase
@@ -82,11 +84,9 @@ public class CompilerMojoTestCase
         throws Exception
     {
         CompilerMojo compileMojo = getCompilerMojo( 
"target/test-classes/unit/compiler-basic-test/plugin-config.xml" );
-        
-        Log log = mock( Log.class );
-        
-        compileMojo.setLog( log );
-        
+
+        Logger log = LoggerFactory.getLogger( compileMojo.getClass() );
+
         compileMojo.execute();
 
         File testClass = new File( compileMojo.getOutputDirectory(), 
"TestCompile0.class" );
@@ -103,7 +103,7 @@ public class CompilerMojoTestCase
                        projectArtifact.getFile() );
 
         testClass = new File( testCompileMojo.getOutputDirectory(), 
"TestCompile0Test.class" );
-        
+
         verify( log ).warn( startsWith( "No explicit value set for target or 
release!" ) );
 
         assertTrue( testClass.exists() );
@@ -113,11 +113,9 @@ public class CompilerMojoTestCase
                     throws Exception
     {
         CompilerMojo compileMojo = getCompilerMojo( 
"target/test-classes/unit/compiler-basic-sourcetarget/plugin-config.xml" );
-        
-        Log log = mock( Log.class );
-        
-        compileMojo.setLog( log );
-        
+
+        Logger log = LoggerFactory.getLogger( compileMojo.getClass() );
+
         compileMojo.execute();
         
         verify( log, never() ).warn( startsWith( "No explicit value set for 
target or release!" ) );

Reply via email to