Skip to content

Commit

Permalink
[MDEP-894] - Use @component instead of @parameter for session/project
Browse files Browse the repository at this point in the history
  • Loading branch information
khmarbaise committed Nov 5, 2023
1 parent f1b2915 commit ad2af95
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public abstract class AbstractDependencyMojo extends AbstractMojo {
/**
* POM
*/
@Parameter(defaultValue = "${project}", readonly = true, required = true)
@Component
private MavenProject project;

/**
Expand All @@ -83,7 +83,7 @@ public abstract class AbstractDependencyMojo extends AbstractMojo {
/**
* The Maven session
*/
@Parameter(defaultValue = "${session}", readonly = true, required = true)
@Component
protected MavenSession session;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
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.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;

/**
Expand All @@ -43,7 +43,7 @@ public class DisplayAncestorsMojo extends AbstractMojo {
/**
* POM
*/
@Parameter(defaultValue = "${project}", readonly = true)
@Component
private MavenProject project;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
public class GetMojo extends AbstractMojo {
private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile("(.+)::(.*)::(.+)");

@Parameter(defaultValue = "${session}", required = true, readonly = true)
@Component
private MavenSession session;

@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
public class ListClassesMojo extends AbstractMojo {
private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile("(.+)::(.*)::(.+)");

@Parameter(defaultValue = "${session}", required = true, readonly = true)
@Component
private MavenSession session;

@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
public class ListRepositoriesMojo extends AbstractDependencyMojo {

@Component
RepositorySystem repositorySystem;
private RepositorySystem repositorySystem;

/**
* Displays a list of the repositories used by this build.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
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 All @@ -49,7 +50,7 @@ public class PropertiesMojo extends AbstractMojo {
/**
* The current Maven project
*/
@Parameter(defaultValue = "${project}", readonly = true, required = true)
@Component
private MavenProject project;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ public class PurgeLocalRepositoryMojo extends AbstractMojo {
/**
* The current Maven project.
*/
@Parameter(defaultValue = "${project}", readonly = true, required = true)
@Component
private MavenProject project;

@Parameter(defaultValue = "${session}", readonly = true, required = true)
@Component
private MavenSession session;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public abstract class AbstractAnalyzeMojo extends AbstractMojo {
/**
* The Maven project to analyze.
*/
@Parameter(defaultValue = "${project}", readonly = true, required = true)
@Component
private MavenProject project;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
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.apache.maven.plugins.annotations.ResolutionScope;
Expand All @@ -53,7 +54,7 @@ public class AnalyzeDepMgt extends AbstractMojo {
/**
*
*/
@Parameter(defaultValue = "${project}", readonly = true, required = true)
@Component
private MavenProject project;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
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.apache.maven.project.MavenProject;
Expand Down Expand Up @@ -65,7 +66,7 @@ public class AnalyzeDuplicateMojo extends AbstractMojo {
/**
* The Maven project to analyze.
*/
@Parameter(defaultValue = "${project}", readonly = true, required = true)
@Component
private MavenProject project;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
public class UnpackMojo extends AbstractFromConfigurationMojo {

@Component
UnpackUtil unpackUtil;
private UnpackUtil unpackUtil;

/**
* Directory to store flag files after unpack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
public class UnpackDependenciesMojo extends AbstractFromDependenciesMojo {

@Component
UnpackUtil unpackUtil;
private UnpackUtil unpackUtil;

/**
* A comma separated list of file patterns to include when unpacking the artifact. i.e.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ public class TreeMojo extends AbstractMojo {
/**
* The Maven project.
*/
@Parameter(defaultValue = "${project}", readonly = true, required = true)
@Component
private MavenProject project;

@Parameter(defaultValue = "${session}", readonly = true, required = true)
@Component
private MavenSession session;

@Parameter(property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}")
Expand Down

0 comments on commit ad2af95

Please sign in to comment.