This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-project-info-reports-plugin.git
The following commit(s) were added to refs/heads/master by this push: new 9022926 Convert to Guice constructor injection (#90) 9022926 is described below commit 90229263d8582094c854124bce3b5bc469a90349 Author: Elliotte Rusty Harold <elh...@users.noreply.github.com> AuthorDate: Sat Dec 14 23:46:02 2024 +0000 Convert to Guice constructor injection (#90) * Convert to Guice constructor injection --- pom.xml | 12 +++++ .../projectinfo/AbstractProjectInfoReport.java | 63 +++++++++++----------- .../report/projectinfo/CiManagementReport.java | 11 ++++ .../report/projectinfo/DependenciesReport.java | 56 ++++++++++++------- .../projectinfo/DependencyConvergenceReport.java | 29 +++++++--- .../projectinfo/DependencyInformationReport.java | 19 ++++--- .../projectinfo/DependencyManagementReport.java | 45 +++++++++++----- .../projectinfo/DistributionManagementReport.java | 11 ++++ .../maven/report/projectinfo/IndexReport.java | 10 ++++ .../report/projectinfo/IssueManagementReport.java | 11 ++++ .../maven/report/projectinfo/LicensesReport.java | 11 ++++ .../report/projectinfo/MailingListsReport.java | 11 ++++ .../maven/report/projectinfo/ModulesReport.java | 11 ++++ .../report/projectinfo/PluginManagementReport.java | 9 ++++ .../maven/report/projectinfo/PluginsReport.java | 9 ++++ .../apache/maven/report/projectinfo/ScmReport.java | 30 ++++++++--- .../maven/report/projectinfo/SummaryReport.java | 15 ++++-- .../maven/report/projectinfo/TeamReport.java | 13 ++++- 18 files changed, 286 insertions(+), 90 deletions(-) diff --git a/pom.xml b/pom.xml index bdd318a..6210ecf 100644 --- a/pom.xml +++ b/pom.xml @@ -267,6 +267,18 @@ under the License. <version>${doxiaSitetoolsVersion}</version> </dependency> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>1</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.eclipse.sisu</groupId> + <artifactId>org.eclipse.sisu.plexus</artifactId> + <version>0.9.0.M3</version> + <scope>provided</scope> + </dependency> <!-- Plexus --> <dependency> <groupId>org.codehaus.plexus</groupId> diff --git a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java index a621423..d4d46f9 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java @@ -36,7 +36,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuilder; @@ -61,31 +60,6 @@ import org.codehaus.plexus.util.xml.Xpp3Dom; * @since 2.0 */ public abstract class AbstractProjectInfoReport extends AbstractMavenReport { - // ---------------------------------------------------------------------- - // Mojo components - // ---------------------------------------------------------------------- - - /** - * Artifact Resolver component. - */ - @Component - protected ArtifactResolver resolver; - - /** - * Artifact Factory component. - */ - @Component - RepositorySystem repositorySystem; - - /** - * Internationalization component, could support also custom bundle using {@link #customBundle}. - */ - @Component - private I18N i18n; - - @Component - protected ProjectBuilder projectBuilder; - // ---------------------------------------------------------------------- // Mojo parameters // ---------------------------------------------------------------------- @@ -152,6 +126,35 @@ public abstract class AbstractProjectInfoReport extends AbstractMavenReport { @Parameter(defaultValue = "${localRepository}", readonly = true, required = true) protected ArtifactRepository localRepository; + // ---------------------------------------------------------------------- + // Mojo components + // ---------------------------------------------------------------------- + + /** + * Artifact Resolver component. + */ + protected final ArtifactResolver resolver; + + /** + * Artifact Factory component. + */ + final RepositorySystem repositorySystem; + + /** + * Internationalization component, could support also custom bundle using {@link #customBundle}. + */ + private I18N i18n; + + protected final ProjectBuilder projectBuilder; + + protected AbstractProjectInfoReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + this.resolver = resolver; + this.repositorySystem = repositorySystem; + this.i18n = i18n; + this.projectBuilder = projectBuilder; + } + // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- @@ -209,7 +212,7 @@ public abstract class AbstractProjectInfoReport extends AbstractMavenReport { /** * @param pluginId The id of the plugin - * @return The information about the plugin. + * @return The information about the plugin */ protected Plugin getPlugin(String pluginId) { if ((getProject().getBuild() == null) || (getProject().getBuild().getPluginsAsMap() == null)) { @@ -232,9 +235,9 @@ public abstract class AbstractProjectInfoReport extends AbstractMavenReport { } /** - * @param pluginId The pluginId - * @param param The child which should be checked. - * @return The value of the dom tree. + * @param pluginId the pluginId + * @param param the child which should be checked + * @return the value of the dom tree */ protected String getPluginParameter(String pluginId, String param) { Plugin plugin = getPlugin(pluginId); diff --git a/src/main/java/org/apache/maven/report/projectinfo/CiManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/CiManagementReport.java index dc3fbf4..96e80a1 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/CiManagementReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/CiManagementReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -29,7 +31,10 @@ import org.apache.maven.model.CiManagement; import org.apache.maven.model.Model; import org.apache.maven.model.Notifier; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; /** @@ -40,6 +45,12 @@ import org.codehaus.plexus.i18n.I18N; */ @Mojo(name = "ci-management") public class CiManagementReport extends AbstractProjectInfoReport { + + @Inject + public CiManagementReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java b/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java index 2d60f2a..d6f246a 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java @@ -18,6 +18,9 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; +import javax.inject.Named; + import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; @@ -32,21 +35,24 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; -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; import org.apache.maven.project.DefaultProjectBuildingRequest; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.report.projectinfo.dependencies.Dependencies; import org.apache.maven.report.projectinfo.dependencies.DependenciesReportConfiguration; import org.apache.maven.report.projectinfo.dependencies.RepositoryUtils; import org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder; import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException; import org.apache.maven.shared.dependency.graph.DependencyNode; import org.apache.maven.shared.jar.classes.JarClassesAnalysis; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; +import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; @@ -64,6 +70,19 @@ public class DependenciesReport extends AbstractProjectInfoReport { */ private static final String RESOURCES_DIR = "org/apache/maven/report/projectinfo/resources"; + // ---------------------------------------------------------------------- + // Mojo parameters + // ---------------------------------------------------------------------- + + /** + * Display file details for each dependency, such as: file size, number of + * classes, number of packages etc. + * + * @since 2.1 + */ + @Parameter(property = "dependency.details.enabled", defaultValue = "true") + private boolean dependencyDetailsEnabled; + // ---------------------------------------------------------------------- // Mojo components // ---------------------------------------------------------------------- @@ -73,37 +92,36 @@ public class DependenciesReport extends AbstractProjectInfoReport { * * @since 2.5 */ - @Component(hint = "default") - private DependencyGraphBuilder dependencyGraphBuilder; + private final DependencyGraphBuilder dependencyGraphBuilder; /** * Jar classes analyzer component. * * @since 2.1 */ - @Component - private JarClassesAnalysis classesAnalyzer; + private final JarClassesAnalysis classesAnalyzer; /** * Repository metadata component. * * @since 2.1 */ - @Component - private RepositoryMetadataManager repositoryMetadataManager; + private final RepositoryMetadataManager repositoryMetadataManager; - // ---------------------------------------------------------------------- - // Mojo parameters - // ---------------------------------------------------------------------- - - /** - * Display file details for each dependency, such as: file size, number of - * classes, number of packages etc. - * - * @since 2.1 - */ - @Parameter(property = "dependency.details.enabled", defaultValue = "true") - private boolean dependencyDetailsEnabled; + @Inject + protected DependenciesReport( + ArtifactResolver resolver, + RepositorySystem repositorySystem, + I18N i18n, + ProjectBuilder projectBuilder, + @Named("default") DependencyGraphBuilder dependencyGraphBuilder, + JarClassesAnalysis classesAnalyzer, + RepositoryMetadataManager repositoryMetadataManager) { + super(resolver, repositorySystem, i18n, projectBuilder); + this.dependencyGraphBuilder = dependencyGraphBuilder; + this.classesAnalyzer = classesAnalyzer; + this.repositoryMetadataManager = repositoryMetadataManager; + } // ---------------------------------------------------------------------- // Public methods diff --git a/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java b/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java index b143aa7..e5edfd4 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -37,14 +39,15 @@ import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.sink.SinkEventAttributes; import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; import org.apache.maven.model.Dependency; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.project.DefaultProjectBuildingRequest; import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.report.projectinfo.dependencies.DependencyVersionMap; import org.apache.maven.report.projectinfo.dependencies.SinkSerializingDependencyNodeVisitor; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; import org.apache.maven.shared.artifact.filter.StrictPatternIncludesArtifactFilter; import org.apache.maven.shared.dependency.graph.DependencyCollectorBuilder; import org.apache.maven.shared.dependency.graph.DependencyCollectorBuilderException; @@ -57,6 +60,8 @@ import org.apache.maven.shared.dependency.graph.traversal.BuildingDependencyNode import org.apache.maven.shared.dependency.graph.traversal.CollectingDependencyNodeVisitor; import org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor; import org.apache.maven.shared.dependency.graph.traversal.FilteringDependencyNodeVisitor; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; +import org.codehaus.plexus.i18n.I18N; /** * Generates the Project Dependency Convergence report for (reactor) builds. @@ -80,6 +85,10 @@ public class DependencyConvergenceReport extends AbstractProjectInfoReport { private static final int FULL_CONVERGENCE = 100; + private ArtifactFilter filter = null; + + private Map<MavenProject, DependencyNode> projectMap = new HashMap<>(); + // ---------------------------------------------------------------------- // Mojo parameters // ---------------------------------------------------------------------- @@ -87,12 +96,18 @@ public class DependencyConvergenceReport extends AbstractProjectInfoReport { /** * Raw dependency collector builder, will use it to build dependency tree. */ - @Component - private DependencyCollectorBuilder dependencyCollectorBuilder; - - private ArtifactFilter filter = null; - - private Map<MavenProject, DependencyNode> projectMap = new HashMap<>(); + private final DependencyCollectorBuilder dependencyCollectorBuilder; + + @Inject + protected DependencyConvergenceReport( + ArtifactResolver resolver, + RepositorySystem repositorySystem, + I18N i18n, + ProjectBuilder projectBuilder, + DependencyCollectorBuilder dependencyCollectorBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + this.dependencyCollectorBuilder = dependencyCollectorBuilder; + } // ---------------------------------------------------------------------- // Public methods diff --git a/src/main/java/org/apache/maven/report/projectinfo/DependencyInformationReport.java b/src/main/java/org/apache/maven/report/projectinfo/DependencyInformationReport.java index 549397a..78bbd7f 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/DependencyInformationReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/DependencyInformationReport.java @@ -18,13 +18,18 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.util.Formatter; import java.util.Locale; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; /** @@ -39,26 +44,24 @@ public final class DependencyInformationReport extends AbstractProjectInfoReport private static final String JAR_PACKAGING = "jar"; private static final String PLUGIN_PACKAGING = "maven-plugin"; - /** - */ @Parameter(defaultValue = "${project.groupId}", required = true) protected String groupId; - /** - */ @Parameter(defaultValue = "${project.artifactId}", required = true) protected String artifactId; - /** - */ @Parameter(defaultValue = "${project.version}", required = true) protected String version; - /** - */ @Parameter(defaultValue = "${project.packaging}", required = true) protected String packaging; + @Inject + public DependencyInformationReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } + // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/DependencyManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/DependencyManagementReport.java index e44a54d..84bbf61 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/DependencyManagementReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/DependencyManagementReport.java @@ -18,19 +18,24 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.util.Locale; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.DefaultProjectBuildingRequest; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.report.projectinfo.dependencies.ManagementDependencies; import org.apache.maven.report.projectinfo.dependencies.RepositoryUtils; import org.apache.maven.report.projectinfo.dependencies.renderer.DependencyManagementRenderer; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; +import org.codehaus.plexus.i18n.I18N; /** * Generates the Project Dependency Management report. @@ -40,6 +45,16 @@ import org.apache.maven.reporting.MavenReportException; */ @Mojo(name = "dependency-management", requiresDependencyResolution = ResolutionScope.TEST) public class DependencyManagementReport extends AbstractProjectInfoReport { + + // ---------------------------------------------------------------------- + // Mojo parameters + // ---------------------------------------------------------------------- + + /** + * Lazy instantiation for management dependencies. + */ + private ManagementDependencies managementDependencies; + // ---------------------------------------------------------------------- // Mojo components // ---------------------------------------------------------------------- @@ -49,25 +64,27 @@ public class DependencyManagementReport extends AbstractProjectInfoReport { * * @since 2.4 */ - @Component - protected ArtifactMetadataSource artifactMetadataSource; + protected final ArtifactMetadataSource artifactMetadataSource; /** * Repository metadata component. * * @since 2.3 */ - @Component - private RepositoryMetadataManager repositoryMetadataManager; - - // ---------------------------------------------------------------------- - // Mojo parameters - // ---------------------------------------------------------------------- - - /** - * Lazy instantiation for management dependencies. - */ - private ManagementDependencies managementDependencies; + private final RepositoryMetadataManager repositoryMetadataManager; + + @Inject + protected DependencyManagementReport( + ArtifactResolver resolver, + RepositorySystem repositorySystem, + I18N i18n, + ProjectBuilder projectBuilder, + ArtifactMetadataSource artifactMetadataSource, + RepositoryMetadataManager repositoryMetadataManager) { + super(resolver, repositorySystem, i18n, projectBuilder); + this.artifactMetadataSource = artifactMetadataSource; + this.repositoryMetadataManager = repositoryMetadataManager; + } // ---------------------------------------------------------------------- // Public methods diff --git a/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java index 59b3d1a..57c04f6 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java @@ -18,13 +18,18 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.util.Locale; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.model.DistributionManagement; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -36,6 +41,12 @@ import org.codehaus.plexus.util.StringUtils; */ @Mojo(name = "distribution-management") public class DistributionManagementReport extends AbstractProjectInfoReport { + + @Inject + public DistributionManagementReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/IndexReport.java b/src/main/java/org/apache/maven/report/projectinfo/IndexReport.java index 5cfae0f..306a710 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/IndexReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/IndexReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.util.List; import java.util.Locale; @@ -29,6 +31,8 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingRequest; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; /** @@ -40,6 +44,12 @@ import org.codehaus.plexus.i18n.I18N; */ @Mojo(name = "index") public class IndexReport extends AbstractProjectInfoReport { + + @Inject + public IndexReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/IssueManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/IssueManagementReport.java index 6082348..c2ceb42 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/IssueManagementReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/IssueManagementReport.java @@ -18,13 +18,18 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.util.Locale; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.model.IssueManagement; import org.apache.maven.model.Model; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; /** @@ -35,6 +40,12 @@ import org.codehaus.plexus.i18n.I18N; */ @Mojo(name = "issue-management") public class IssueManagementReport extends AbstractProjectInfoReport { + + @Inject + public IssueManagementReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/LicensesReport.java b/src/main/java/org/apache/maven/report/projectinfo/LicensesReport.java index 25d166d..2adcd65 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/LicensesReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/LicensesReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -34,8 +36,11 @@ import org.apache.maven.model.License; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; import org.apache.maven.settings.Settings; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -75,6 +80,12 @@ public class LicensesReport extends AbstractProjectInfoReport { @Parameter private String licenseFileEncoding; + @Inject + public LicensesReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } + // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java b/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java index 2d4e425..6246736 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.net.URI; import java.util.ArrayList; import java.util.Iterator; @@ -29,7 +31,10 @@ import org.apache.maven.model.MailingList; import org.apache.maven.model.Model; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -42,6 +47,12 @@ import org.codehaus.plexus.util.StringUtils; */ @Mojo(name = "mailing-lists") public class MailingListsReport extends AbstractProjectInfoReport { + + @Inject + public MailingListsReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java b/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java index b9f189e..9cc4e0a 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -37,6 +39,8 @@ import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; /** @@ -47,6 +51,13 @@ import org.codehaus.plexus.i18n.I18N; */ @Mojo(name = "modules") public class ModulesReport extends AbstractProjectInfoReport { + + @Inject + public ModulesReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } + // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java index 2c2c7aa..6480fa9 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -40,6 +42,7 @@ import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -62,6 +65,12 @@ public class PluginManagementReport extends AbstractProjectInfoReport { @Parameter private List<String> pluginManagementExcludes = null; + @Inject + public PluginManagementReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } + // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java b/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java index 83a6f98..7bea1de 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -39,6 +41,7 @@ import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -50,6 +53,12 @@ import org.codehaus.plexus.util.StringUtils; */ @Mojo(name = "plugins", requiresDependencyResolution = ResolutionScope.TEST) public class PluginsReport extends AbstractProjectInfoReport { + + @Inject + public PluginsReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java b/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java index 71e6026..90dfd54 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -26,15 +28,17 @@ import org.apache.maven.doxia.sink.Sink; import org.apache.maven.model.Model; import org.apache.maven.model.Scm; import org.apache.maven.plugin.logging.Log; -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.ProjectBuilder; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; import org.apache.maven.scm.manager.ScmManager; import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository; import org.apache.maven.scm.provider.hg.repository.HgScmProviderRepository; import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository; import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -51,13 +55,7 @@ public class ScmReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- /** - * Maven SCM Manager. - */ - @Component - protected ScmManager scmManager; - - /** - * The directory name to checkout right after the SCM URL. + * The directory name to check out right after the SCM URL. */ @Parameter(defaultValue = "${project.artifactId}") private String checkoutDirectoryName; @@ -96,6 +94,22 @@ public class ScmReport extends AbstractProjectInfoReport { @Parameter(defaultValue = "${project.scm.tag}") private String scmTag; + /** + * Maven SCM Manager. + */ + protected final ScmManager scmManager; + + @Inject + public ScmReport( + ArtifactResolver resolver, + RepositorySystem repositorySystem, + I18N i18n, + ProjectBuilder projectBuilder, + ScmManager scmManager) { + super(resolver, repositorySystem, i18n, projectBuilder); + this.scmManager = scmManager; + } + // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/report/projectinfo/SummaryReport.java b/src/main/java/org/apache/maven/report/projectinfo/SummaryReport.java index a2cb397..b10624b 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/SummaryReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/SummaryReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.io.File; import java.io.IOException; import java.util.Locale; @@ -27,7 +29,11 @@ import org.apache.maven.model.DistributionManagement; import org.apache.maven.model.Organization; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; +import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.Xpp3Dom; @@ -40,9 +46,12 @@ import org.codehaus.plexus.util.xml.Xpp3Dom; */ @Mojo(name = "summary") public class SummaryReport extends AbstractProjectInfoReport { - // ---------------------------------------------------------------------- - // Mojo parameters - // ---------------------------------------------------------------------- + + @Inject + public SummaryReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } // ---------------------------------------------------------------------- // Public methods diff --git a/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java b/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java index 10e0823..bdbe52f 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java @@ -18,6 +18,8 @@ */ package org.apache.maven.report.projectinfo; +import javax.inject.Inject; + import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; @@ -33,7 +35,10 @@ import org.apache.maven.model.Developer; import org.apache.maven.model.Model; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.reporting.MavenReportException; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -49,7 +54,7 @@ public class TeamReport extends AbstractProjectInfoReport { * Shows avatar images for team members that have a) properties/picUrl set b) An avatar at gravatar.com for their * email address * <p/> - * Future versions of this plugin may choose to implement different strategies for resolving avatar images, possibly + * Future versions of this plugin may implement different strategies for resolving avatar images, possibly * using different providers. *<p> *<strong>Note</strong>: This property will be renamed to {@code tteam.showAvatarImages} in 3.0. @@ -58,6 +63,12 @@ public class TeamReport extends AbstractProjectInfoReport { @Parameter(property = "teamlist.showAvatarImages", defaultValue = "true") private boolean showAvatarImages; + @Inject + public TeamReport( + ArtifactResolver resolver, RepositorySystem repositorySystem, I18N i18n, ProjectBuilder projectBuilder) { + super(resolver, repositorySystem, i18n, projectBuilder); + } + // ---------------------------------------------------------------------- // Public methods // ----------------------------------------------------------------------