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] Drop Maven2 support Revert usage DependencyGraphBuilder, it is not an exact replacement of DependencyTreeBuilder (improved verify script)
Date Sat, 31 Mar 2018 19:11:05 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 fededa8  [MPIR-366] Drop Maven2 support Revert usage DependencyGraphBuilder, it is
not an exact replacement of DependencyTreeBuilder (improved verify script)
fededa8 is described below

commit fededa835b37d28ffda31eb4b5362fce126754f6
Author: rfscholte <rfscholte@apache.org>
AuthorDate: Sat Mar 31 21:10:58 2018 +0200

    [MPIR-366] Drop Maven2 support
    Revert usage DependencyGraphBuilder, it is not an exact replacement of DependencyTreeBuilder
(improved verify script)
---
 pom.xml                                            |  2 +-
 src/it/full-pom/verify.bsh                         | 10 ++++
 .../report/projectinfo/DependenciesReport.java     | 13 +++--
 .../projectinfo/DependencyConvergenceReport.java   | 30 +++++-----
 .../projectinfo/dependencies/Dependencies.java     |  2 +-
 .../dependencies/DependencyVersionMap.java         |  4 +-
 .../SinkSerializingDependencyNodeVisitor.java      |  4 +-
 .../renderer/DependenciesRenderer.java             | 67 ++++++++++------------
 .../DependencyConvergenceReportTest.java           |  6 +-
 9 files changed, 70 insertions(+), 68 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2bfa26d..f265537 100644
--- a/pom.xml
+++ b/pom.xml
@@ -183,7 +183,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-dependency-tree</artifactId>
-      <version>3.0.1</version>
+      <version>2.2</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
diff --git a/src/it/full-pom/verify.bsh b/src/it/full-pom/verify.bsh
index 314810f..7dcd40e 100644
--- a/src/it/full-pom/verify.bsh
+++ b/src/it/full-pom/verify.bsh
@@ -124,6 +124,16 @@ try
         System.err.println( "MPIR-216: dependency-management doesn't contain doxia-sink-api
url http://maven.apache.org/doxia/doxia/doxia-sink-api/" );
         return false;
     }
+    
+    File dependencyConvergence = new File( siteDir, "dependency-convergence.html");
+    content = FileUtils.fileRead( dependencyConvergence, "UTF-8" );
+    
+    if ( !content.contains( "You do not have 100% convergence." ) )
+    {
+        System.err.println( "dependency-convergence not rendered correctly" );
+        return false;
+    }
+    
 }
 catch ( Throwable t )
 {
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 703216e..20d1992 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java
@@ -46,9 +46,9 @@ import org.apache.maven.report.projectinfo.dependencies.DependenciesReportConfig
 import org.apache.maven.report.projectinfo.dependencies.RepositoryUtils;
 import org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer;
 import org.apache.maven.report.projectinfo.wagon.WagonRepositoryConnectorFactory;
-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.dependency.tree.DependencyNode;
+import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
+import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
 import org.apache.maven.shared.jar.classes.JarClassesAnalysis;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
@@ -97,7 +97,7 @@ public class DependenciesReport
      * @since 2.5
      */
     @Component( hint = "default" )
-    private DependencyGraphBuilder dependencyGraphBuilder;
+    private DependencyTreeBuilder dependencyTreeBuilder;
 
     /**
      * Jar classes analyzer component.
@@ -229,9 +229,10 @@ public class DependenciesReport
             buildingRequest.setProject( getProject() );
             
             ArtifactFilter artifactFilter = new ScopeArtifactFilter( Artifact.SCOPE_TEST
);
-            return dependencyGraphBuilder.buildDependencyGraph( buildingRequest, artifactFilter
);
+            return dependencyTreeBuilder.buildDependencyTree( buildingRequest.getProject(),
localRepository,
+                                                              artifactFilter );
         }
-        catch ( DependencyGraphBuilderException e )
+        catch ( DependencyTreeBuilderException e )
         {
             getLog().error( "Unable to build dependency tree.", e );
             return null;
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 8ff2b09..f6738b4 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
@@ -48,17 +48,17 @@ 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.shared.artifact.filter.StrictPatternIncludesArtifactFilter;
-import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
-import org.apache.maven.shared.dependency.graph.DependencyNode;
-import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException;
-import org.apache.maven.shared.dependency.graph.filter.AncestorOrSelfDependencyNodeFilter;
-import org.apache.maven.shared.dependency.graph.filter.AndDependencyNodeFilter;
-import org.apache.maven.shared.dependency.graph.filter.ArtifactDependencyNodeFilter;
-import org.apache.maven.shared.dependency.graph.filter.DependencyNodeFilter;
-import org.apache.maven.shared.dependency.graph.traversal.BuildingDependencyNodeVisitor;
-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.dependency.tree.DependencyTreeBuilder;
+import org.apache.maven.shared.dependency.tree.DependencyNode;
+import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
+import org.apache.maven.shared.dependency.tree.filter.AncestorOrSelfDependencyNodeFilter;
+import org.apache.maven.shared.dependency.tree.filter.AndDependencyNodeFilter;
+import org.apache.maven.shared.dependency.tree.filter.ArtifactDependencyNodeFilter;
+import org.apache.maven.shared.dependency.tree.filter.DependencyNodeFilter;
+import org.apache.maven.shared.dependency.tree.traversal.BuildingDependencyNodeVisitor;
+import org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor;
+import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
+import org.apache.maven.shared.dependency.tree.traversal.FilteringDependencyNodeVisitor;
 
 /**
  * Generates the Project Dependency Convergence report for (reactor) builds.
@@ -94,7 +94,7 @@ public class DependencyConvergenceReport
      * Dependency tree builder, will use it to build dependency tree.
      */
     @Component
-    private DependencyGraphBuilder dependencyGraphBuilder;
+    private DependencyTreeBuilder dependencyTreeBuilder;
 
     private ArtifactFilter filter = null;
 
@@ -915,11 +915,13 @@ public class DependencyConvergenceReport
         try
         {
             DependencyNode node =
-                (DependencyNode) dependencyGraphBuilder.buildDependencyGraph( buildingRequest,
filter );
+                (DependencyNode) dependencyTreeBuilder.buildDependencyTree( buildingRequest.getProject(),
+                                                                            localRepository,
+                                                                            filter );
 
             return node;
         }
-        catch ( DependencyGraphBuilderException e )
+        catch ( DependencyTreeBuilderException e )
         {
             throw new MavenReportException( "Could not build dependency tree: " + e.getMessage(),
e );
         }
diff --git a/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java
b/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java
index 6e8b0a9..11d43fc 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java
@@ -29,7 +29,7 @@ import java.util.jar.JarEntry;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.dependency.graph.DependencyNode;
+import org.apache.maven.shared.dependency.tree.DependencyNode;
 import org.apache.maven.shared.jar.JarAnalyzer;
 import org.apache.maven.shared.jar.JarData;
 import org.apache.maven.shared.jar.classes.JarClasses;
diff --git a/src/main/java/org/apache/maven/report/projectinfo/dependencies/DependencyVersionMap.java
b/src/main/java/org/apache/maven/report/projectinfo/dependencies/DependencyVersionMap.java
index 0bf5e20..5b17d41 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/dependencies/DependencyVersionMap.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/dependencies/DependencyVersionMap.java
@@ -25,8 +25,8 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.shared.dependency.graph.DependencyNode;
-import org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor;
+import org.apache.maven.shared.dependency.tree.DependencyNode;
+import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
 
 /**
  * @author Simon Wang
diff --git a/src/main/java/org/apache/maven/report/projectinfo/dependencies/SinkSerializingDependencyNodeVisitor.java
b/src/main/java/org/apache/maven/report/projectinfo/dependencies/SinkSerializingDependencyNodeVisitor.java
index 9751b0d..46d5bb9 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/dependencies/SinkSerializingDependencyNodeVisitor.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/dependencies/SinkSerializingDependencyNodeVisitor.java
@@ -22,8 +22,8 @@ package org.apache.maven.report.projectinfo.dependencies;
 import java.util.List;
 
 import org.apache.maven.doxia.sink.Sink;
-import org.apache.maven.shared.dependency.graph.DependencyNode;
-import org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor;
+import org.apache.maven.shared.dependency.tree.DependencyNode;
+import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
 
 /**
  * A dependency node visitor that serializes visited nodes to a sink writer. It's used to
serialize tree in project
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 8db4bc4..c3a0f25 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
@@ -61,7 +61,8 @@ import org.apache.maven.report.projectinfo.dependencies.DependenciesReportConfig
 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.dependency.graph.DependencyNode;
+import org.apache.maven.shared.artifact.resolve.ArtifactResolverException;
+import org.apache.maven.shared.dependency.tree.DependencyNode;
 import org.apache.maven.shared.jar.JarData;
 import org.codehaus.plexus.i18n.I18N;
 import org.codehaus.plexus.util.StringUtils;
@@ -1256,43 +1257,33 @@ public class DependenciesRenderer
      */
     private void resolveAtrifacts( List<Artifact> artifacts )
     {
-//        for ( Artifact artifact : artifacts )
-//        {
-//            // TODO site:run Why do we need to resolve this...
-//            if ( artifact.getFile() == null )
-//            {
-//                if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
-//                {
-//                    // can not resolve system scope artifact file
-//                    continue;
-//                }
-//
-//                try
-//                {
-//                    repoUtils.resolve( artifact );
-//                }
-//                catch ( ArtifactResolverException e )
-//                {
-//                    if ( ( dependencies.getProject().getGroupId().equals( artifact.getGroupId()
) )
-//                        && ( dependencies.getProject().getArtifactId().equals(
artifact.getArtifactId() ) )
-//                        && ( dependencies.getProject().getVersion().equals( artifact.getVersion()
) ) )
-//                    {
-//                        log.warn( "The artifact of this project has never been deployed."
);
-//                    }
-//                    else
-//                    {
-//                        log.error( "Artifact " + artifact.getId() + " can't be resolved.",
e );
-//                    }
-//
-//                    continue;
-//                }
-//
-//                if ( artifact.getFile() == null )
-//                {
-//                    log.error( "Artifact " + artifact.getId() + " has no file, even after
resolution." );
-//                }
-//            }
-//        }
+        for ( Artifact artifact : artifacts )
+        {
+            // TODO site:run Why do we need to resolve this...
+            if ( artifact.getFile() == null )
+            {
+                if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
+                {
+                    // can not resolve system scope artifact file
+                    continue;
+                }
+
+                try
+                {
+                    repoUtils.resolve( artifact );
+                }
+                catch ( ArtifactResolverException e )
+                {
+                    log.error( "Artifact " + artifact.getId() + " can't be resolved.", e
);
+                    continue;
+                }
+
+                if ( artifact.getFile() == null )
+                {
+                    log.error( "Artifact " + artifact.getId() + " has no file, even after
resolution." );
+                }
+            }
+        }
     }
 
     private Object invoke( Object object, String method )
diff --git a/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java
b/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java
index 4614324..00b9fcc 100644
--- a/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java
+++ b/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java
@@ -23,8 +23,6 @@ import java.io.File;
 
 import java.net.URL;
 
-import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
-
 import com.meterware.httpunit.GetMethodWebRequest;
 import com.meterware.httpunit.TextBlock;
 import com.meterware.httpunit.WebConversation;
@@ -85,8 +83,8 @@ public class DependencyConvergenceReportTest
         AbstractProjectInfoReport mojo = super.createReportMojo( goal, pluginXmlFile );
 
         // Test is confused because org.eclipse.aether.artifact.Artifact is also on the classpath
-        DependencyGraphBuilder dependencyGraphBuilder = lookup( DependencyGraphBuilder.class,
"maven3" );
-        setVariableValueToObject( mojo, "dependencyGraphBuilder", dependencyGraphBuilder
);
+//        DependencyGraphBuilder dependencyGraphBuilder = lookup( DependencyGraphBuilder.class,
"maven3" );
+//        setVariableValueToObject( mojo, "dependencyGraphBuilder", dependencyGraphBuilder
);
         
         return mojo;
     }

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

Mime
View raw message