Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
*/
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,8 +53,7 @@ public class AddPluginArtifactMetadataMojo extends AbstractMojo {
/**
* The project artifact, which should have the <code>latest</code> metadata added to it.
*/
@Component
private MavenProject project;
private final MavenProject project;

/**
* The prefix for the plugin goal.
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>plugin-info.html</code>,
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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}
Expand Down
1 change: 0 additions & 1 deletion maven-plugin-tools-annotations/src/site/apt/index.apt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down