Skip to content

Commit 250e0fb

Browse files
committed
Convert to Guice
1 parent 5307e98 commit 250e0fb

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
*/
1919
package org.apache.maven.plugins.checkstyle.exec;
2020

21+
import javax.inject.Inject;
22+
import javax.inject.Named;
23+
2124
import java.io.ByteArrayInputStream;
2225
import java.io.File;
2326
import java.io.FileInputStream;
@@ -49,8 +52,6 @@
4952
import org.apache.maven.artifact.DependencyResolutionRequiredException;
5053
import org.apache.maven.model.Resource;
5154
import org.apache.maven.project.MavenProject;
52-
import org.codehaus.plexus.component.annotations.Component;
53-
import org.codehaus.plexus.component.annotations.Requirement;
5455
import org.codehaus.plexus.logging.AbstractLogEnabled;
5556
import org.codehaus.plexus.resource.ResourceManager;
5657
import org.codehaus.plexus.resource.loader.FileResourceCreationException;
@@ -63,14 +64,20 @@
6364
* @since 2.5
6465
*
6566
*/
66-
@Component(role = CheckstyleExecutor.class, hint = "default", instantiationStrategy = "per-lookup")
67+
@Named
6768
public class DefaultCheckstyleExecutor extends AbstractLogEnabled implements CheckstyleExecutor {
68-
@Requirement(hint = "default")
6969
private ResourceManager locator;
7070

71-
@Requirement(hint = "license")
7271
private ResourceManager licenseLocator;
7372

73+
@Inject
74+
public DefaultCheckstyleExecutor(
75+
@Named("default") ResourceManager locator, @Named("license") ResourceManager licenseLocator) {
76+
this.locator = locator;
77+
this.licenseLocator = licenseLocator;
78+
}
79+
80+
@Override
7481
public CheckstyleResults executeCheckstyle(CheckstyleExecutorRequest request)
7582
throws CheckstyleExecutorException, CheckstyleException {
7683
if (getLogger().isDebugEnabled()) {
@@ -255,6 +262,7 @@ protected void addSourceDirectory(
255262
}
256263
}
257264

265+
@Override
258266
public Configuration getConfiguration(CheckstyleExecutorRequest request) throws CheckstyleExecutorException {
259267
try {
260268
// Checkstyle will always use the context classloader in order

0 commit comments

Comments
 (0)