Skip to content

Commit

Permalink
Prefer Guice injection in sample
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Dec 13, 2024
1 parent 09471a6 commit 2b81047
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.eclipse.aether.RepositorySystem;
Expand All @@ -43,11 +42,6 @@
@Mojo(name = "resolve-artifact", threadSafe = true)
public class ResolveArtifactMojo extends AbstractMojo {
private static final Logger LOGGER = LoggerFactory.getLogger(ResolveArtifactMojo.class);
/**
* The entry point to Maven Artifact Resolver, i.e. the component doing all the work.
*/
@Component
private RepositorySystem repoSystem;

/**
* The current repository/network configuration of Maven.
Expand All @@ -67,6 +61,16 @@ public class ResolveArtifactMojo extends AbstractMojo {
@Parameter(property = "resolver.artifactCoords", readonly = true)
private String artifactCoords;

/**
* The entry point to Maven Artifact Resolver; that is, the component doing all the work.
*/
private final RepositorySystem repoSystem;

@Inject
public ResolveArtifactMojo(RepositorySystem repoSystem) {
this.repoSystem = repoSystem;
}

/**
* The actual execution of the mojo.
*/
Expand Down

0 comments on commit 2b81047

Please sign in to comment.