diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java b/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java index 1ad2baca..5ea8902b 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java @@ -18,6 +18,9 @@ */ package org.apache.maven.plugins.checkstyle.exec; +import javax.inject.Inject; +import javax.inject.Named; + import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; @@ -49,8 +52,6 @@ import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.model.Resource; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.resource.ResourceManager; import org.codehaus.plexus.resource.loader.FileResourceCreationException; @@ -63,14 +64,20 @@ * @since 2.5 * */ -@Component(role = CheckstyleExecutor.class, hint = "default", instantiationStrategy = "per-lookup") +@Named public class DefaultCheckstyleExecutor extends AbstractLogEnabled implements CheckstyleExecutor { - @Requirement(hint = "default") private ResourceManager locator; - @Requirement(hint = "license") private ResourceManager licenseLocator; + @Inject + public DefaultCheckstyleExecutor( + @Named("default") ResourceManager locator, @Named("license") ResourceManager licenseLocator) { + this.locator = locator; + this.licenseLocator = licenseLocator; + } + + @Override public CheckstyleResults executeCheckstyle(CheckstyleExecutorRequest request) throws CheckstyleExecutorException, CheckstyleException { if (getLogger().isDebugEnabled()) { @@ -255,6 +262,7 @@ protected void addSourceDirectory( } } + @Override public Configuration getConfiguration(CheckstyleExecutorRequest request) throws CheckstyleExecutorException { try { // Checkstyle will always use the context classloader in order