maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject [maven-project-info-reports-plugin] branch MPIR-366 updated: [MPIR-366] Replace ArtifactFactory with RepositorySystem
Date Fri, 30 Mar 2018 19:59:37 GMT
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MPIR-366
in repository https://gitbox.apache.org/repos/asf/maven-project-info-reports-plugin.git


The following commit(s) were added to refs/heads/MPIR-366 by this push:
     new 6874abe  [MPIR-366] Replace ArtifactFactory with RepositorySystem
6874abe is described below

commit 6874abefcb9d42c325f99f6454930d9e76976e30
Author: rfscholte <rfscholte@apache.org>
AuthorDate: Fri Mar 30 21:59:31 2018 +0200

    [MPIR-366] Replace ArtifactFactory with RepositorySystem
---
 .../projectinfo/AbstractProjectInfoReport.java     |  4 ++--
 .../report/projectinfo/DependenciesReport.java     | 13 ++---------
 .../projectinfo/DependencyConvergenceReport.java   | 26 ++--------------------
 .../projectinfo/DependencyManagementReport.java    | 11 ++-------
 .../report/projectinfo/PluginManagementReport.java | 20 ++++++-----------
 .../maven/report/projectinfo/PluginsReport.java    | 18 ++++++++-------
 .../report/projectinfo/ProjectInfoReportUtils.java | 18 +++++----------
 .../maven/report/projectinfo/TeamReport.java       |  3 ---
 .../projectinfo/dependencies/RepositoryUtils.java  | 15 +++++++------
 .../renderer/DependenciesRenderer.java             | 15 ++++++-------
 .../renderer/DependencyManagementRenderer.java     | 17 +++++++-------
 11 files changed, 54 insertions(+), 106 deletions(-)

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 9a033e9..d8d4a29 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java
@@ -37,7 +37,6 @@ import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.doxia.site.decoration.Body;
 import org.apache.maven.doxia.site.decoration.DecorationModel;
@@ -57,6 +56,7 @@ import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuilder;
 import org.apache.maven.reporting.AbstractMavenReport;
 import org.apache.maven.reporting.MavenReportException;
+import org.apache.maven.repository.RepositorySystem;
 import org.apache.maven.settings.Settings;
 import org.apache.maven.shared.artifact.resolve.ArtifactResolver;
 import org.codehaus.plexus.i18n.I18N;
@@ -107,7 +107,7 @@ public abstract class AbstractProjectInfoReport
      * Artifact Factory component.
      */
     @Component
-    protected ArtifactFactory factory;
+    RepositorySystem repositorySystem;
 
     /**
      * Internationalization component, could support also custom bundle using {@link #customBundle}.
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 cba8db1..59be399 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java
@@ -30,7 +30,6 @@ import java.io.OutputStream;
 import java.util.Locale;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
@@ -117,14 +116,6 @@ public class DependenciesReport
     @Component
     private RepositoryMetadataManager repositoryMetadataManager;
 
-    /**
-     * Maven Artifact Factory component.
-     *
-     * @since 2.1
-     */
-    @Component
-    private ArtifactFactory artifactFactory;
-
     // ----------------------------------------------------------------------
     // Mojo parameters
     // ----------------------------------------------------------------------
@@ -191,7 +182,7 @@ public class DependenciesReport
         buildingRequest.setRemoteRepositories( remoteRepositories );
 
         RepositoryUtils repoUtils =
-            new RepositoryUtils( getLog(), wagonRepositoryConnectorFactory, projectBuilder,
factory, resolver,
+            new RepositoryUtils( getLog(), wagonRepositoryConnectorFactory, projectBuilder,
repositorySystem, resolver,
                                  project.getRemoteArtifactRepositories(), project.getPluginArtifactRepositories(),
                                  buildingRequest, repositoryMetadataManager );
 
@@ -204,7 +195,7 @@ public class DependenciesReport
 
         DependenciesRenderer r =
             new DependenciesRenderer( getSink(), locale, getI18N( locale ), getLog(), settings,
dependencies,
-                                      dependencyNode, config, repoUtils, artifactFactory,
projectBuilder,
+                                      dependencyNode, config, repoUtils, repositorySystem,
projectBuilder,
                                       buildingRequest );
         r.render();
     }
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 79de506..93c4f79 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
@@ -33,9 +33,6 @@ import java.util.Set;
 import java.util.TreeMap;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.resolver.ArtifactCollector;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.sink.SinkEventAttributeSet;
@@ -98,28 +95,9 @@ public class DependencyConvergenceReport
      * Dependency tree builder, will use it to build dependency tree.
      */
     @Component
-    DependencyGraphBuilder dependencyGraphBuilder;
+    private DependencyGraphBuilder dependencyGraphBuilder;
 
-    /**
-     * Use it to build dependency(artifact) tree
-     */
-    @Component
-    ArtifactFactory factory;
-
-    /**
-     * Use it to get artifact metadata source for dependency tree building.
-     */
-    @Component
-    ArtifactMetadataSource metadataSource;
-
-    /**
-     * Artifact collector - takes a set of original artifacts and resolves all of the best
versions to use along with
-     * their metadata.
-     */
-    @Component
-    ArtifactCollector collector;
-
-    ArtifactFilter filter = null;
+    private ArtifactFilter filter = null;
 
     private Map<MavenProject, DependencyNode> projectMap = new HashMap<MavenProject,
DependencyNode>();
 
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 5b4777f..3859d96 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/DependencyManagementReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/DependencyManagementReport.java
@@ -21,7 +21,6 @@ package org.apache.maven.report.projectinfo;
 
 import java.util.Locale;
 
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
 import org.apache.maven.plugins.annotations.Component;
@@ -65,12 +64,6 @@ public class DependencyManagementReport
     protected ArtifactMetadataSource artifactMetadataSource;
 
     /**
-     * Maven Artifact Factory component.
-     */
-    @Component
-    private ArtifactFactory artifactFactory;
-
-    /**
      * Wagon manager component.
      *
      * @since 3.0.0
@@ -120,13 +113,13 @@ public class DependencyManagementReport
         buildingRequest.setRemoteRepositories( remoteRepositories );
         
         RepositoryUtils repoUtils =
-            new RepositoryUtils( getLog(), wagonRepositoryConnectorFactory, projectBuilder,
factory, resolver,
+            new RepositoryUtils( getLog(), wagonRepositoryConnectorFactory, projectBuilder,
repositorySystem, resolver,
                                  project.getRemoteArtifactRepositories(), project.getPluginArtifactRepositories(),
                                  buildingRequest, repositoryMetadataManager );
 
         DependencyManagementRenderer r =
             new DependencyManagementRenderer( getSink(), locale, getI18N( locale ), getLog(),
-                                              getManagementDependencies(), artifactMetadataSource,
artifactFactory,
+                                              getManagementDependencies(), artifactMetadataSource,
repositorySystem,
                                               projectBuilder, buildingRequest, repoUtils
);
         r.render();
     }
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 f6696b2..f172964 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java
@@ -20,7 +20,6 @@ package org.apache.maven.report.projectinfo;
  */
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.model.Plugin;
@@ -34,6 +33,7 @@ import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.repository.RepositorySystem;
 import org.codehaus.plexus.i18n.I18N;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -63,12 +63,6 @@ public class PluginManagementReport
     @Component
     private ProjectBuilder projectBuilder;
 
-    /**
-     * Maven Artifact Factory component.
-     */
-    @Component
-    private ArtifactFactory artifactFactory;
-
     // ----------------------------------------------------------------------
     // Public methods
     // ----------------------------------------------------------------------
@@ -79,7 +73,7 @@ public class PluginManagementReport
         PluginManagementRenderer r =
             new PluginManagementRenderer( getLog(), getSink(), locale, getI18N( locale ),
                                           project.getPluginManagement().getPlugins(), project,
projectBuilder,
-                                          artifactFactory, getSession().getProjectBuildingRequest()
);
+                                          repositorySystem, getSession().getProjectBuildingRequest()
);
         r.render();
     }
 
@@ -128,7 +122,7 @@ public class PluginManagementReport
 
         private final ProjectBuilder projectBuilder;
 
-        private final ArtifactFactory artifactFactory;
+        private final RepositorySystem repositorySystem;
 
         private final ProjectBuildingRequest buildingRequest;
 
@@ -140,12 +134,12 @@ public class PluginManagementReport
          * @param plugins {@link Plugin}
          * @param project {@link MavenProject}
          * @param projectBuilder {@link ProjectBuilder}
-         * @param artifactFactory {@link ArtifactFactory}
+         * @param repositorySystem {@link RepositorySystem}
          * @param buildingRequest {@link ArtifactRepository}
          */
         public PluginManagementRenderer( Log log, Sink sink, Locale locale, I18N i18n, List<Plugin>
plugins,
                                          MavenProject project, ProjectBuilder projectBuilder,
-                                         ArtifactFactory artifactFactory, ProjectBuildingRequest
buildingRequest )
+                                         RepositorySystem repositorySystem, ProjectBuildingRequest
buildingRequest )
         {
             super( sink, i18n, locale );
 
@@ -157,7 +151,7 @@ public class PluginManagementReport
 
             this.projectBuilder = projectBuilder;
 
-            this.artifactFactory = artifactFactory;
+            this.repositorySystem = repositorySystem;
 
             this.buildingRequest = buildingRequest;
         }
@@ -216,7 +210,7 @@ public class PluginManagementReport
                     versionRange = VersionRange.createFromVersion( plugin.getVersion() );
                 }
 
-                Artifact pluginArtifact = artifactFactory.createParentArtifact( plugin.getGroupId(),
plugin
+                Artifact pluginArtifact = repositorySystem.createProjectArtifact( plugin.getGroupId(),
plugin
                     .getArtifactId(), versionRange.toString() );
 
                 try
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 c77eb5e..ff73ffe 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java
@@ -26,7 +26,6 @@ import java.util.List;
 import java.util.Locale;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.doxia.sink.Sink;
@@ -41,6 +40,7 @@ import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.repository.RepositorySystem;
 import org.codehaus.plexus.i18n.I18N;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -69,7 +69,7 @@ public class PluginsReport
      * Maven Artifact Factory component.
      */
     @Component
-    private ArtifactFactory artifactFactory;
+    private RepositorySystem repositorySystem;
 
     // ----------------------------------------------------------------------
     // Public methods
@@ -92,7 +92,7 @@ public class PluginsReport
     {
         PluginsRenderer r =
             new PluginsRenderer( getLog(), getSink(), locale, getI18N( locale ), project.getBuildPlugins(),
-                                 project.getReportPlugins(), project, projectBuilder, artifactFactory,
+                                 project.getReportPlugins(), project, projectBuilder, repositorySystem,
                                  getSession().getProjectBuildingRequest() );
         r.render();
     }
@@ -129,7 +129,7 @@ public class PluginsReport
 
         private final ProjectBuilder projectBuilder;
 
-        private final ArtifactFactory artifactFactory;
+        private final RepositorySystem repositorySystem;
 
         private final ProjectBuildingRequest buildingRequest;
 
@@ -142,13 +142,13 @@ public class PluginsReport
          * @param reports {@link Artifact}
          * @param project {@link MavenProject}
          * @param projectBuilder {@link ProjectBuilder}
-         * @param artifactFactory {@link ArtifactFactory}
+         * @param repositorySystem {@link RepositorySystem}
          * @param localRepository {@link ArtifactRepository}
          *
          */
         public PluginsRenderer( Log log, Sink sink, Locale locale, I18N i18n, List<Plugin>
plugins,
                                 List<ReportPlugin> reports, MavenProject project,
-                                ProjectBuilder projectBuilder, ArtifactFactory artifactFactory,
+                                ProjectBuilder projectBuilder, RepositorySystem repositorySystem,
                                 ProjectBuildingRequest buildingRequest )
         {
             super( sink, i18n, locale );
@@ -163,7 +163,7 @@ public class PluginsReport
 
             this.projectBuilder = projectBuilder;
 
-            this.artifactFactory = artifactFactory;
+            this.repositorySystem = repositorySystem;
 
             this.buildingRequest = buildingRequest;
         }
@@ -191,6 +191,7 @@ public class PluginsReport
         private void renderSectionPlugins( boolean isPlugins )
         {
             List<GAV> list = isPlugins ? GAV.pluginsToGAV( plugins ) : GAV.reportPluginsToGAV(
reports, project );
+            
             String[] tableHeader = getPluginTableHeader();
 
             startSection( getI18nString( isPlugins ? "build.title" : "report.title" ) );
@@ -221,8 +222,9 @@ public class PluginsReport
             {
                 VersionRange versionRange = VersionRange.createFromVersion( plugin.getVersion()
);
 
+                
                 Artifact pluginArtifact =
-                    artifactFactory.createParentArtifact( plugin.getGroupId(), plugin.getArtifactId(),
+                                repositorySystem.createProjectArtifact( plugin.getGroupId(),
plugin.getArtifactId(),
                                                           versionRange.toString() );
                 try
                 {
diff --git a/src/main/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtils.java
b/src/main/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtils.java
index 6f09c50..9fc2b47 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtils.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtils.java
@@ -44,14 +44,11 @@ import org.apache.commons.validator.routines.RegexValidator;
 import org.apache.commons.validator.routines.UrlValidator;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.project.ProjectBuildingRequest;
-// CHECKSTYLE_OFF: UnusedImports
-import org.apache.maven.reporting.AbstractMavenReportRenderer;
-// CHECKSTYLE_ON: UnusedImports
+import org.apache.maven.repository.RepositorySystem;
 import org.apache.maven.settings.Proxy;
 import org.apache.maven.settings.Server;
 import org.apache.maven.settings.Settings;
@@ -216,11 +213,8 @@ public class ProjectInfoReportUtils
      * @param buildingRequest not null
      * @return the artifact url or null if an error occurred.
      */
-    // CHECKSTYLE_OFF: LineLength
-    public static String getArtifactUrl( ArtifactFactory factory, Artifact artifact,
-                                         ProjectBuilder projectBuilder,
-                                         ProjectBuildingRequest buildingRequest )
-    // CHECKSTYLE_ON: LineLength
+    public static String getArtifactUrl( RepositorySystem repositorySystem, Artifact artifact,
+                                         ProjectBuilder projectBuilder, ProjectBuildingRequest
buildingRequest )
     {
         if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
         {
@@ -231,8 +225,8 @@ public class ProjectInfoReportUtils
         if ( !"pom".equals( copyArtifact.getType() ) )
         {
             copyArtifact =
-                factory.createProjectArtifact( copyArtifact.getGroupId(), copyArtifact.getArtifactId(),
-                                               copyArtifact.getVersion(), copyArtifact.getScope()
);
+                repositorySystem.createProjectArtifact( copyArtifact.getGroupId(), copyArtifact.getArtifactId(),
+                                                        copyArtifact.getVersion() );
         }
         try
         {
@@ -255,7 +249,7 @@ public class ProjectInfoReportUtils
      * @param artifactId not null
      * @param link could be null
      * @return the artifactId cell with or without a link pattern
-     * @see AbstractMavenReportRenderer#linkPatternedText(String)
+     * @see {@link org.apache.maven.reporting.AbstractMavenReportRenderer#linkPatternedText(String)}
      */
     public static String getArtifactIdCell( String artifactId, String link )
     {
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 0d526cf..ab0c23e 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java
@@ -135,8 +135,6 @@ public class TeamReport
 
         private final Model model;
 
-        private final Log log;
-
         private final boolean showAvatarImages;
 
         private final String protocol;
@@ -146,7 +144,6 @@ public class TeamReport
             super( sink, i18n, locale );
 
             this.model = model;
-            this.log = log;
             this.showAvatarImages = showAvatarImages;
 
             // prepare protocol for gravatar
diff --git a/src/main/java/org/apache/maven/report/projectinfo/dependencies/RepositoryUtils.java
b/src/main/java/org/apache/maven/report/projectinfo/dependencies/RepositoryUtils.java
index d54e1f4..f648019 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/dependencies/RepositoryUtils.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/dependencies/RepositoryUtils.java
@@ -25,7 +25,6 @@ import java.util.List;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.metadata.Metadata;
@@ -41,6 +40,7 @@ import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.report.projectinfo.wagon.WagonRepositoryConnector;
 import org.apache.maven.report.projectinfo.wagon.WagonRepositoryConnectorException;
 import org.apache.maven.report.projectinfo.wagon.WagonRepositoryConnectorFactory;
+import org.apache.maven.repository.RepositorySystem;
 import org.apache.maven.shared.artifact.resolve.ArtifactResolver;
 import org.apache.maven.shared.artifact.resolve.ArtifactResolverException;
 import org.apache.maven.shared.artifact.resolve.ArtifactResult;
@@ -64,7 +64,7 @@ public class RepositoryUtils
 
     private final ProjectBuilder projectBuilder;
 
-    private final ArtifactFactory factory;
+    private final RepositorySystem repositorySystem;
 
     private final List<ArtifactRepository> remoteRepositories;
 
@@ -77,7 +77,7 @@ public class RepositoryUtils
     /**
      * @param log {@link Log}
      * @param projectBuilder {@link ProjectBuilder}
-     * @param factory {@link ArtifactFactory}
+     * @param repositorySystem {@link RepositorySystem}
      * @param resolver {@link ArtifactResolver}
      * @param remoteRepositories {@link ArtifactRepository}
      * @param pluginRepositories {@link ArtifactRepository}
@@ -86,7 +86,7 @@ public class RepositoryUtils
      * @param wagonManager {@link WagonManager}
      */
     public RepositoryUtils( Log log, WagonRepositoryConnectorFactory wagonRepositoryConnectorFactory,
-                            ProjectBuilder projectBuilder, ArtifactFactory factory, ArtifactResolver
resolver,
+                            ProjectBuilder projectBuilder, RepositorySystem repositorySystem,
ArtifactResolver resolver,
                             List<ArtifactRepository> remoteRepositories, List<ArtifactRepository>
pluginRepositories,
                             ProjectBuildingRequest buildingRequest,
                             RepositoryMetadataManager repositoryMetadataManager )
@@ -94,7 +94,7 @@ public class RepositoryUtils
         this.log = log;
         this.wagonRepositoryConnectorFactory = wagonRepositoryConnectorFactory;
         this.projectBuilder = projectBuilder;
-        this.factory = factory;
+        this.repositorySystem = repositorySystem;
         this.resolver = resolver;
         this.remoteRepositories = remoteRepositories;
         this.pluginRepositories = pluginRepositories;
@@ -227,8 +227,9 @@ public class RepositoryUtils
         boolean allowStubModel = false;
         if ( !"pom".equals( artifact.getType() ) )
         {
-            projectArtifact = factory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(),
-                                                             artifact.getVersion(), artifact.getScope()
);
+            projectArtifact = repositorySystem.createProjectArtifact( artifact.getGroupId(),

+                                                                      artifact.getArtifactId(),
+                                                                      artifact.getVersion()
);
             allowStubModel = true;
         }
 
diff --git a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
index fb19a37..f50f10a 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
@@ -42,7 +42,6 @@ import java.util.SortedSet;
 import java.util.TreeSet;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
 import org.apache.maven.doxia.sink.Sink;
@@ -60,6 +59,7 @@ import org.apache.maven.report.projectinfo.ProjectInfoReportUtils;
 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.repository.RepositorySystem;
 import org.apache.maven.settings.Settings;
 import org.apache.maven.shared.artifact.resolve.ArtifactResolverException;
 import org.apache.maven.shared.dependency.graph.DependencyNode;
@@ -132,7 +132,7 @@ public class DependenciesRenderer
         }
     };
 
-    private final ArtifactFactory artifactFactory;
+    private final RepositorySystem repositorySystem;
 
     private final ProjectBuilder projectBuilder;
 
@@ -163,14 +163,14 @@ public class DependenciesRenderer
      * @param dependencyTreeNode {@link DependencyNode}
      * @param config {@link DependenciesReportConfiguration}
      * @param repoUtils {@link RepositoryUtils}
-     * @param artifactFactory {@link ArtifactFactory}
+     * @param repositorySystem {@link RepositorySystem}
      * @param projectBuilder {@link ProjectBuilder}
      * @param buildingRequest {@link ProjectBuildingRequest}
      */
     public DependenciesRenderer( Sink sink, Locale locale, I18N i18n, Log log, Settings settings,
                                  Dependencies dependencies, DependencyNode dependencyTreeNode,
                                  DependenciesReportConfiguration config, RepositoryUtils
repoUtils,
-                                 ArtifactFactory artifactFactory, ProjectBuilder projectBuilder,
+                                 RepositorySystem repositorySystem, ProjectBuilder projectBuilder,
                                  ProjectBuildingRequest buildingRequest )
     {
         super( sink, i18n, locale );
@@ -181,7 +181,7 @@ public class DependenciesRenderer
         this.dependencyNode = dependencyTreeNode;
         this.repoUtils = repoUtils;
         this.configuration = config;
-        this.artifactFactory = artifactFactory;
+        this.repositorySystem = repositorySystem;
         this.projectBuilder = projectBuilder;
         this.buildingRequest = buildingRequest; 
 
@@ -776,7 +776,6 @@ public class DependenciesRenderer
         }
     }
 
-    @SuppressWarnings( "unchecked" )
     private void renderSectionDependencyRepositoryLocations()
     {
         startSection( getI18nString( "repo.locations.title" ) );
@@ -888,7 +887,7 @@ public class DependenciesRenderer
             artifact.isOptional() ? getI18nString( "column.isOptional" ) : getI18nString(
"column.isNotOptional" );
 
         String url =
-            ProjectInfoReportUtils.getArtifactUrl( artifactFactory, artifact, projectBuilder,
buildingRequest );
+            ProjectInfoReportUtils.getArtifactUrl( repositorySystem, artifact, projectBuilder,
buildingRequest );
         String artifactIdCell = ProjectInfoReportUtils.getArtifactIdCell( artifact.getArtifactId(),
url );
 
         MavenProject artifactProject;
@@ -990,7 +989,7 @@ public class DependenciesRenderer
                 String artifactDescription = artifactProject.getDescription();
                 String artifactUrl = artifactProject.getUrl();
                 String artifactName = artifactProject.getName();
-                @SuppressWarnings( "unchecked" )
+
                 List<License> licenses = artifactProject.getLicenses();
 
                 sink.tableRow();
diff --git a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependencyManagementRenderer.java
b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependencyManagementRenderer.java
index db1b9d3..87d7b97 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependencyManagementRenderer.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependencyManagementRenderer.java
@@ -27,7 +27,6 @@ import java.util.Locale;
 import java.util.Map;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
 import org.apache.maven.artifact.versioning.ArtifactVersion;
@@ -45,6 +44,7 @@ import org.apache.maven.report.projectinfo.AbstractProjectInfoRenderer;
 import org.apache.maven.report.projectinfo.ProjectInfoReportUtils;
 import org.apache.maven.report.projectinfo.dependencies.ManagementDependencies;
 import org.apache.maven.report.projectinfo.dependencies.RepositoryUtils;
+import org.apache.maven.repository.RepositorySystem;
 import org.codehaus.plexus.i18n.I18N;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -62,7 +62,7 @@ public class DependencyManagementRenderer
 
     private final ArtifactMetadataSource artifactMetadataSource;
 
-    private final ArtifactFactory artifactFactory;
+    private final RepositorySystem repositorySystem;
 
     private final ProjectBuilder projectBuilder;
 
@@ -79,7 +79,7 @@ public class DependencyManagementRenderer
      * @param log {@link Log}
      * @param dependencies {@link ManagementDependencies}
      * @param artifactMetadataSource {@link ArtifactMetadataSource}
-     * @param artifactFactory {@link ArtifactFactory}
+     * @param repositorySystem {@link RepositorySystem}
      * @param projectBuilder {@link ProjectBuilder}
      * @param remoteRepositories {@link ArtifactRepository}
      * @param localRepository {@link ArtifactRepository}
@@ -88,7 +88,7 @@ public class DependencyManagementRenderer
     public DependencyManagementRenderer( Sink sink, Locale locale, I18N i18n, Log log,
                                          ManagementDependencies dependencies,
                                          ArtifactMetadataSource artifactMetadataSource,
-                                         ArtifactFactory artifactFactory, ProjectBuilder
projectBuilder,
+                                         RepositorySystem repositorySystem, ProjectBuilder
projectBuilder,
                                          ProjectBuildingRequest buildingRequest, RepositoryUtils
repoUtils )
     {
         super( sink, i18n, locale );
@@ -96,7 +96,7 @@ public class DependencyManagementRenderer
         this.log = log;
         this.dependencies = dependencies;
         this.artifactMetadataSource = artifactMetadataSource;
-        this.artifactFactory = artifactFactory;
+        this.repositorySystem = repositorySystem;
         this.projectBuilder = projectBuilder;
         this.buildingRequest = buildingRequest;
         this.repoUtils = repoUtils;
@@ -212,9 +212,8 @@ public class DependencyManagementRenderer
     @SuppressWarnings( "unchecked" )
     private String[] getDependencyRow( Dependency dependency, boolean hasClassifier )
     {
-        Artifact artifact =
-            artifactFactory.createProjectArtifact( dependency.getGroupId(), dependency.getArtifactId(),
-                                                   dependency.getVersion() );
+        Artifact artifact = repositorySystem.createProjectArtifact( dependency.getGroupId(),
dependency.getArtifactId(),
+                                                                    dependency.getVersion()
);
 
         StringBuilder licensesBuffer = new StringBuilder();
         String url = null;
@@ -250,7 +249,7 @@ public class DependencyManagementRenderer
                 }
             }
 
-            url = ProjectInfoReportUtils.getArtifactUrl( artifactFactory, artifact, projectBuilder,
buildingRequest );
+            url = ProjectInfoReportUtils.getArtifactUrl( repositorySystem, artifact, projectBuilder,
buildingRequest );
 
             MavenProject artifactProject = repoUtils.getMavenProjectFromRepository( artifact
);
 

-- 
To stop receiving notification emails like this one, please contact
rfscholte@apache.org.

Mime
View raw message