diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
index 8434aa556..4b4af6e5d 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
@@ -35,7 +35,6 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
-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;
@@ -223,9 +222,6 @@ public class DescriptorGeneratorMojo extends AbstractGeneratorMojo {
@Parameter(property = "internalJavadocVersion", defaultValue = "${java.version}")
protected String internalJavadocVersion;
- @Component
- private MavenSession mavenSession;
-
/**
* The required Java version to set in the plugin descriptor. This is evaluated by Maven 4 and ignored by earlier
* Maven versions. Can be either one of the following formats:
@@ -262,6 +258,8 @@ public class DescriptorGeneratorMojo extends AbstractGeneratorMojo {
@Parameter(defaultValue = VALUE_AUTO)
String requiredMavenVersion;
+ private final MavenSession mavenSession;
+
/**
* The component used for scanning the source tree for mojos.
*/
@@ -270,8 +268,10 @@ public class DescriptorGeneratorMojo extends AbstractGeneratorMojo {
protected final BuildContext buildContext;
@Inject
- public DescriptorGeneratorMojo(MavenProject project, MojoScanner mojoScanner, BuildContext buildContext) {
+ public DescriptorGeneratorMojo(
+ MavenProject project, MavenSession mavenSession, MojoScanner mojoScanner, BuildContext buildContext) {
super(project);
+ this.mavenSession = mavenSession;
this.mojoScanner = mojoScanner;
this.buildContext = buildContext;
}
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java
index fe1d382db..3332c4156 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java
@@ -18,10 +18,11 @@
*/
package org.apache.maven.plugin.plugin.metadata;
+import javax.inject.Inject;
+
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
-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;
@@ -52,8 +53,7 @@ public class AddPluginArtifactMetadataMojo extends AbstractMojo {
/**
* The project artifact, which should have the latest metadata added to it.
*/
- @Component
- private MavenProject project;
+ private final MavenProject project;
/**
* The prefix for the plugin goal.
@@ -69,11 +69,16 @@ public class AddPluginArtifactMetadataMojo extends AbstractMojo {
@Parameter(defaultValue = "false", property = "maven.plugin.skip")
private boolean skip;
- @Component
- private RuntimeInformation runtimeInformation;
+ private final RuntimeInformation runtimeInformation;
private final VersionScheme versionScheme = new GenericVersionScheme();
+ @Inject
+ public AddPluginArtifactMetadataMojo(MavenProject project, RuntimeInformation runtimeInformation) {
+ this.project = project;
+ this.runtimeInformation = runtimeInformation;
+ }
+
/** {@inheritDoc} */
@Override
public void execute() throws MojoExecutionException {
diff --git a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginNoForkReport.java b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginNoForkReport.java
index 8b5466977..1117639ac 100644
--- a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginNoForkReport.java
+++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginNoForkReport.java
@@ -18,9 +18,16 @@
*/
package org.apache.maven.plugin.plugin.report;
+import javax.inject.Inject;
+
+import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.rtinfo.RuntimeInformation;
+import org.codehaus.plexus.i18n.I18N;
+import org.eclipse.aether.RepositorySystem;
/**
* Generates the plugin's report: the plugin details page at plugin-info.html,
@@ -31,4 +38,15 @@
*/
@Mojo(name = "report-no-fork", threadSafe = true)
@Execute(phase = LifecyclePhase.NONE)
-public class PluginNoForkReport extends PluginReport {}
+public class PluginNoForkReport extends PluginReport {
+
+ @Inject
+ public PluginNoForkReport(
+ RuntimeInformation rtInfo,
+ I18N i18n,
+ MavenSession mavenSession,
+ RepositorySystem repositorySystem,
+ ProjectBuilder projectBuilder) {
+ super(rtInfo, i18n, mavenSession, repositorySystem, projectBuilder);
+ }
+}
diff --git a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java
index dd8f94848..266774218 100644
--- a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java
+++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java
@@ -18,6 +18,8 @@
*/
package org.apache.maven.plugin.plugin.report;
+import javax.inject.Inject;
+
import java.io.File;
import java.io.IOException;
import java.io.Reader;
@@ -36,7 +38,6 @@
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
-import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
@@ -118,14 +119,12 @@ public class PluginReport extends AbstractMavenReport {
@Parameter(defaultValue = "[0,)")
private String requirementsHistoryDetectionRange;
- @Component
- private RuntimeInformation rtInfo;
+ private final RuntimeInformation rtInfo;
/**
* Internationalization component.
*/
- @Component
- private I18N i18n;
+ private final I18N i18n;
/**
* Path to enhanced plugin descriptor to generate the report from (must contain some XHTML values)
@@ -148,14 +147,25 @@ public class PluginReport extends AbstractMavenReport {
@Parameter(property = "maven.plugin.report.disableInternalJavadocLinkValidation")
private boolean disableInternalJavadocLinkValidation;
- @Component
- private MavenSession mavenSession;
+ private final MavenSession mavenSession;
+
+ private final RepositorySystem repositorySystem;
- @Component
- private RepositorySystem repositorySystem;
+ private final ProjectBuilder projectBuilder;
- @Component
- private ProjectBuilder projectBuilder;
+ @Inject
+ public PluginReport(
+ RuntimeInformation rtInfo,
+ I18N i18n,
+ MavenSession mavenSession,
+ RepositorySystem repositorySystem,
+ ProjectBuilder projectBuilder) {
+ this.rtInfo = rtInfo;
+ this.i18n = i18n;
+ this.mavenSession = mavenSession;
+ this.repositorySystem = repositorySystem;
+ this.projectBuilder = projectBuilder;
+ }
/**
* {@inheritDoc}
diff --git a/maven-plugin-tools-annotations/src/site/apt/index.apt b/maven-plugin-tools-annotations/src/site/apt/index.apt
index dad471dfa..b7e3a96f9 100644
--- a/maven-plugin-tools-annotations/src/site/apt/index.apt
+++ b/maven-plugin-tools-annotations/src/site/apt/index.apt
@@ -40,7 +40,6 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.InstantiationStrategy;
import org.apache.maven.plugins.annotations.LifecyclePhase;