Skip to content

Commit

Permalink
final
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Nov 19, 2024
1 parent 9c42365 commit 422e145
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 32 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/apache/maven/plugins/dependency/GetMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,25 @@
public class GetMojo extends AbstractMojo {
private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile("(.+)::(.*)::(.+)");

private MavenSession session;
private final MavenSession session;

private ArtifactResolver artifactResolver;
private final ArtifactResolver artifactResolver;

private DependencyResolver dependencyResolver;
private final DependencyResolver dependencyResolver;

private ArtifactHandlerManager artifactHandlerManager;
private final ArtifactHandlerManager artifactHandlerManager;

/**
* Map that contains the layouts.
*/
private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
private final Map<String, ArtifactRepositoryLayout> repositoryLayouts;

/**
* The repository system.
*/
private RepositorySystem repositorySystem;
private final RepositorySystem repositorySystem;

private DefaultDependableCoordinate coordinate = new DefaultDependableCoordinate();
private final DefaultDependableCoordinate coordinate = new DefaultDependableCoordinate();

/**
* Repositories in the format id::[layout]::url or just url, separated by comma. ie.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
@Mojo(name = "list-classes", requiresProject = false, threadSafe = true)
public class ListClassesMojo extends AbstractMojo {

private ResolverUtil resolverUtil;
private final ResolverUtil resolverUtil;

private ParamArtifact paramArtifact = new ParamArtifact();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
@Mojo(name = "list-repositories", threadSafe = true)
public class ListRepositoriesMojo extends AbstractDependencyMojo {

private RepositorySystem repositorySystem;
private final RepositorySystem repositorySystem;

@Inject
public ListRepositoriesMojo(RepositorySystem repositorySystem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class PropertiesMojo extends AbstractMojo {
/**
* The current Maven project
*/
private MavenProject project;
private final MavenProject project;

@Inject
public PropertiesMojo(MavenProject project) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,24 @@ public class PurgeLocalRepositoryMojo extends AbstractMojo {
/**
* The current Maven project.
*/
private MavenProject project;
private final MavenProject project;

private MavenSession session;
private final MavenSession session;

/**
* Artifact handler manager.
*/
private ArtifactHandlerManager artifactHandlerManager;
private final ArtifactHandlerManager artifactHandlerManager;

/**
* The dependency resolver
*/
private DependencyResolver dependencyResolver;
private final DependencyResolver dependencyResolver;

/**
* The artifact resolver used to re-resolve dependencies, if that option is enabled.
*/
private ArtifactResolver artifactResolver;
private final ArtifactResolver artifactResolver;

/**
* The Maven projects in the reactor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
public class AnalyzeDepMgt extends AbstractMojo {
// fields -----------------------------------------------------------------

private MavenProject project;
private final MavenProject project;

/**
* Fail the build if a problem is detected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ public class AnalyzeReport extends AbstractMavenReport {
/**
* The Maven project dependency analyzer to use.
*/
private ProjectDependencyAnalyzer analyzer;
private final ProjectDependencyAnalyzer analyzer;

/**
* Internationalization component
*/
private final I18N i18n;

/**
* Ignore Runtime/Provided/Test/System scopes for unused dependency analysis
Expand Down Expand Up @@ -84,11 +89,6 @@ public class AnalyzeReport extends AbstractMavenReport {
@Parameter(property = "mdep.analyze.excludedClasses")
private Set<String> excludedClasses;

/**
* Internationalization component
*/
private I18N i18n;

@Inject
public AnalyzeReport(ProjectDependencyAnalyzer analyzer, I18N i18n) {
this.analyzer = analyzer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
@Mojo(name = "analyze-exclusions", requiresDependencyCollection = ResolutionScope.TEST, threadSafe = true)
public class AnalyzeExclusionsMojo extends AbstractMojo {

private MavenProject project;
private final MavenProject project;

private ResolverUtil resolverUtil;
private final ResolverUtil resolverUtil;

private MavenSession session;
private final MavenSession session;

@Inject
public AnalyzeExclusionsMojo(MavenProject project, ResolverUtil resolverUtil, MavenSession session) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@Mojo(name = "copy", defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresProject = false, threadSafe = true)
public class CopyMojo extends AbstractFromConfigurationMojo {

private CopyUtil copyUtil;
private final CopyUtil copyUtil;

/**
* Strip artifact version during copy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@Mojo(name = "unpack", defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresProject = false, threadSafe = true)
public class UnpackMojo extends AbstractFromConfigurationMojo {

private UnpackUtil unpackUtil;
private final UnpackUtil unpackUtil;

/**
* Directory to store flag files after unpack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public class CopyDependenciesMojo extends AbstractFromDependenciesMojo {
@Parameter(property = "mdep.copyPom", defaultValue = "false")
protected boolean copyPom;

private CopyUtil copyUtil;
private final CopyUtil copyUtil;

private ArtifactInstaller installer;
private final ArtifactInstaller installer;

@Inject
public CopyDependenciesMojo(CopyUtil copyUtil, ArtifactInstaller installer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@

import java.io.File;

import javax.inject.Inject;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
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;
Expand Down Expand Up @@ -50,8 +51,12 @@
// CHECKSTYLE_ON: LineLength
public class UnpackDependenciesMojo extends AbstractFromDependenciesMojo {

@Component
private UnpackUtil unpackUtil;
private final UnpackUtil unpackUtil;

@Inject
public UnpackDependenciesMojo(UnpackUtil unpackUtil) {
this.unpackUtil = unpackUtil;
}

/**
* A comma separated list of file patterns to include when unpacking the artifact. i.e.
Expand Down

0 comments on commit 422e145

Please sign in to comment.