diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java index 218fc27c..2a7accb4 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java @@ -18,6 +18,8 @@ */ package org.apache.maven.plugins.checkstyle; +import javax.inject.Inject; + import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; @@ -47,7 +49,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.descriptor.PluginDescriptor; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -294,12 +295,6 @@ public class CheckstyleViolationCheckMojo extends AbstractMojo { @Parameter(property = "encoding", defaultValue = "${project.build.sourceEncoding}") private String inputEncoding; - /** - * @since 2.5 - */ - @Component(role = CheckstyleExecutor.class, hint = "default") - protected CheckstyleExecutor checkstyleExecutor; - /** * Output errors to console. */ @@ -487,6 +482,16 @@ public class CheckstyleViolationCheckMojo extends AbstractMojo { private File outputXmlFile; + /** + * @since 2.5 + */ + private CheckstyleExecutor checkstyleExecutor; + + @Inject + public CheckstyleViolationCheckMojo(CheckstyleExecutor checkstyleExecutor) { + this.checkstyleExecutor = checkstyleExecutor; + } + /** {@inheritDoc} */ @Override public void execute() throws MojoExecutionException, MojoFailureException {