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] 01/01: [MPIR-366] Drop Maven 2 support Switch to Maven 3.0 dependencies + required code changes
Date Fri, 30 Mar 2018 10:29:52 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

commit 228c3eee0e66b831c9cc119f44ba185c1325a3e1
Author: rfscholte <rfscholte@apache.org>
AuthorDate: Fri Mar 30 12:29:44 2018 +0200

    [MPIR-366] Drop Maven 2 support
    Switch to Maven 3.0 dependencies + required code changes
---
 pom.xml                                            | 33 +++++-----
 src/it/mpir-229/verify.groovy                      |  2 +-
 .../projectinfo/AbstractProjectInfoReport.java     |  9 +++
 .../report/projectinfo/DependenciesReport.java     |  9 ++-
 .../projectinfo/DependencyConvergenceReport.java   | 42 ++++++------
 .../dependencies/DependencyVersionMap.java         |  4 +-
 .../projectinfo/dependencies/RepositoryUtils.java  |  2 +-
 .../SinkSerializingDependencyNodeVisitor.java      |  4 +-
 .../projectinfo/AbstractProjectInfoTestCase.java   | 69 +++++++++++---------
 .../DependencyConvergenceReportTest.java           |  2 +
 .../report/projectinfo/ModulesReportTest.java      |  3 +-
 .../stubs/DependencyArtifactStubFactory.java       | 74 ++++++++++++++++++++++
 .../projectinfo/AbstractProjectInfoTestCase.xml    | 32 ----------
 13 files changed, 182 insertions(+), 103 deletions(-)

diff --git a/pom.xml b/pom.xml
index d3a991e..933cfc0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -119,7 +119,7 @@ under the License.
   <properties>
     <doxiaVersion>1.6</doxiaVersion>
     <doxia-sitetoolsVersion>1.6</doxia-sitetoolsVersion>
-    <mavenVersion>2.2.1</mavenVersion>
+    <mavenVersion>3.0</mavenVersion>
     <wagonVersion>2.10</wagonVersion>
     <scmVersion>1.9.5</scmVersion>
     <sitePluginVersion>3.5.1</sitePluginVersion>
@@ -134,33 +134,35 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.reporting</groupId>
       <artifactId>maven-reporting-impl</artifactId>
-      <version>2.4</version>
+      <version>3.0.0</version>
     </dependency>
 
     <!-- Maven -->
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
+      <artifactId>maven-compat</artifactId>
       <version>${mavenVersion}</version>
+<!--       <scope>test</scope> -->
     </dependency>
+    
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact-manager</artifactId>
+      <artifactId>maven-artifact</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-model</artifactId>
+      <artifactId>maven-core</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-plugin-api</artifactId>
+      <artifactId>maven-model</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-project</artifactId>
+      <artifactId>maven-plugin-api</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
     <dependency>
@@ -176,7 +178,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-dependency-tree</artifactId>
-      <version>2.2</version>
+      <version>3.0.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
@@ -197,7 +199,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-common-artifact-filters</artifactId>
-      <version>1.4</version>
+      <version>3.0.1</version>
     </dependency>
 
     <!-- Wagon -->
@@ -348,11 +350,6 @@ under the License.
       <artifactId>plexus-interpolation</artifactId>
       <version>1.24</version>
     </dependency>
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-container-default</artifactId>
-      <version>1.0-alpha-9-stable-1</version>
-    </dependency>
 
     <!-- Test -->
     <dependency>
@@ -364,7 +361,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.plugin-testing</groupId>
       <artifactId>maven-plugin-testing-harness</artifactId>
-      <version>1.3</version>
+      <version>2.1</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -397,6 +394,12 @@ under the License.
       <artifactId>commons-lang</artifactId>
       <version>2.6</version>
     </dependency>
+    <dependency>
+      <groupId>org.sonatype.aether</groupId>
+      <artifactId>aether-connector-wagon</artifactId>
+      <version>1.7</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/src/it/mpir-229/verify.groovy b/src/it/mpir-229/verify.groovy
index b6080f9..efd9543 100644
--- a/src/it/mpir-229/verify.groovy
+++ b/src/it/mpir-229/verify.groovy
@@ -17,4 +17,4 @@
  * under the License.
  */
 File modulesPage = new File( basedir, 'target/site/modules.html' )
-assert modulesPage.text.contains( '<a href="mpir-229-module1-1.0-SNAPSHOT/index.html">mpir-229-module1</a>'
)
\ No newline at end of file
+assert modulesPage.text.contains( '<a href="mpir-229-module1-1.0-SNAPSHOT/index.html"
title="mpir-229-module1">mpir-229-module1</a>' )
\ No newline at end of file
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 2647551..de7bec1 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java
@@ -49,6 +49,7 @@ import org.apache.maven.doxia.siterenderer.SiteRenderingContext;
 import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
 import org.apache.maven.doxia.tools.SiteTool;
 import org.apache.maven.doxia.tools.SiteToolException;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Component;
@@ -138,6 +139,9 @@ public abstract class AbstractProjectInfoReport
      */
     @Parameter( defaultValue = "${project}", readonly = true, required = true )
     protected MavenProject project;
+    
+    @Parameter( defaultValue = "${session}", readonly = true, required = true )
+    private MavenSession session;
 
     /**
      * Local Repository.
@@ -320,6 +324,11 @@ public abstract class AbstractProjectInfoReport
     {
         return project;
     }
+    
+    protected MavenSession getSession()
+    {
+        return session;
+    }
 
     /**
      * Reactor projects
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 6756807..6222329 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java
@@ -39,7 +39,9 @@ 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.MavenProjectBuilder;
+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;
@@ -145,6 +147,7 @@ public class DependenciesReport
      */
     @Parameter( property = "dependency.locations.enabled", defaultValue = "true" )
     private boolean dependencyLocationsEnabled;
+    
 
     // ----------------------------------------------------------------------
     // Public methods
@@ -227,8 +230,12 @@ public class DependenciesReport
     {
         try
         {
+            ProjectBuildingRequest buildingRequest =
+                new DefaultProjectBuildingRequest( getSession().getProjectBuildingRequest()
);
+            buildingRequest.setProject( getProject() );
+            
             ArtifactFilter artifactFilter = new ScopeArtifactFilter( Artifact.SCOPE_TEST
);
-            return dependencyGraphBuilder.buildDependencyGraph( project, artifactFilter );
+            return dependencyGraphBuilder.buildDependencyGraph( buildingRequest, artifactFilter
);
         }
         catch ( DependencyGraphBuilderException e )
         {
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 85ec81e..79de506 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
@@ -44,22 +44,24 @@ import org.apache.maven.model.Dependency;
 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.DefaultProjectBuildingRequest;
 import org.apache.maven.project.MavenProject;
+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.shared.artifact.filter.StrictPatternIncludesArtifactFilter;
-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.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;
+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;
 
 /**
  * Generates the Project Dependency Convergence report for (reactor) builds.
@@ -96,7 +98,7 @@ public class DependencyConvergenceReport
      * Dependency tree builder, will use it to build dependency tree.
      */
     @Component
-    DependencyTreeBuilder dependencyTreeBuilder;
+    DependencyGraphBuilder dependencyGraphBuilder;
 
     /**
      * Use it to build dependency(artifact) tree
@@ -767,9 +769,14 @@ public class DependencyConvergenceReport
             new TreeMap<String, List<ReverseDependencyLink>>();
         Map<String, List<ReverseDependencyLink>> allDependencies = new TreeMap<String,
List<ReverseDependencyLink>>();
 
+        ProjectBuildingRequest buildingRequest =
+            new DefaultProjectBuildingRequest( getSession().getProjectBuildingRequest() );
+        
         for ( MavenProject reactorProject : reactorProjects )
         {
-            DependencyNode node = getNode( reactorProject );
+            buildingRequest.setProject( reactorProject );
+            
+            DependencyNode node = getNode( buildingRequest );
 
             this.projectMap.put( reactorProject, node );
 
@@ -921,22 +928,21 @@ public class DependencyConvergenceReport
     /**
      * Get root node of dependency tree for a given project
      *
-     * @param project
+     * @param buildingRequest
      * @return root node of dependency tree
      * @throws MavenReportException
      */
-    private DependencyNode getNode( MavenProject project )
+    private DependencyNode getNode( ProjectBuildingRequest buildingRequest )
         throws MavenReportException
     {
         try
         {
             DependencyNode node =
-                (DependencyNode) dependencyTreeBuilder.buildDependencyTree( project, localRepository,
factory,
-                                                                            metadataSource,
filter, collector );
+                (DependencyNode) dependencyGraphBuilder.buildDependencyGraph( buildingRequest,
filter );
 
             return node;
         }
-        catch ( DependencyTreeBuilderException e )
+        catch ( DependencyGraphBuilderException e )
         {
             throw new MavenReportException( "Could not build dependency tree: " + e.getMessage(),
e );
         }
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 f7f3e6e..5c0ace8 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.tree.DependencyNode;
-import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
+import org.apache.maven.shared.dependency.graph.DependencyNode;
+import org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor;
 
 /**
  * @author Simon Wang
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 25346b6..fe6d6b3 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
@@ -26,7 +26,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.manager.WagonConfigurationException;
 import org.apache.maven.artifact.manager.WagonManager;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -41,6 +40,7 @@ import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.repository.legacy.WagonConfigurationException;
 import org.apache.maven.settings.Proxy;
 import org.apache.maven.settings.Settings;
 import org.apache.maven.wagon.ConnectionException;
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 46d5bb9..9751b0d 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.tree.DependencyNode;
-import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
+import org.apache.maven.shared.dependency.graph.DependencyNode;
+import org.apache.maven.shared.dependency.graph.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/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java
b/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java
index f7ae9bc..b0522d6 100644
--- a/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java
+++ b/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java
@@ -1,5 +1,11 @@
 package org.apache.maven.report.projectinfo;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+
+import org.apache.maven.plugin.LegacySupport;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -20,17 +26,19 @@ package org.apache.maven.report.projectinfo;
  */
 
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.plugin.testing.ArtifactStubFactory;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.profiles.DefaultProfileManager;
 import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.report.projectinfo.stubs.DependencyArtifactStubFactory;
 import org.codehaus.plexus.i18n.I18N;
 import org.codehaus.plexus.util.StringUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Locale;
+import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
+import org.sonatype.aether.util.DefaultRepositorySystemSession;
 
 /**
  * Abstract class to test reports generation with <a href="http://www.httpunit.org/">HTTPUnit</a>
framework.
@@ -42,6 +50,8 @@ import java.util.Locale;
 public abstract class AbstractProjectInfoTestCase
     extends AbstractMojoTestCase
 {
+    private ArtifactStubFactory artifactStubFactory;
+    
     /**
      * The default locale is English.
      */
@@ -64,31 +74,16 @@ public abstract class AbstractProjectInfoTestCase
         // required for mojo lookups to work
         super.setUp();
 
-        i18n = (I18N) getContainer().lookup( I18N.ROLE );
-
-        File f = new File( getBasedir(), "target/local-repo/" );
-        f.mkdirs();
+        i18n = getContainer().lookup( I18N.class );
+        setVariableValueToObject( i18n, "defaultBundleName", "project-info-reports" );
 
+        artifactStubFactory = new DependencyArtifactStubFactory( getTestFile( "target" ),
true, false );
+        artifactStubFactory.getWorkingDir().mkdirs();
+        
         // Set the default Locale
         Locale.setDefault( DEFAULT_LOCALE );
     }
 
-    protected InputStream getCustomConfiguration()
-        throws Exception
-    {
-        // Allow sub classes to have their own configuration...
-        if ( super.getConfiguration() == null )
-        {
-            String className = AbstractProjectInfoTestCase.class.getName();
-
-            String config = className.substring( className.lastIndexOf( "." ) + 1 ) + ".xml";
-
-            return AbstractProjectInfoTestCase.class.getResourceAsStream( config );
-        }
-
-        return null;
-    }
-
     @Override
     protected void tearDown()
         throws Exception
@@ -145,6 +140,11 @@ public abstract class AbstractProjectInfoTestCase
         return testMavenProject;
     }
 
+    protected ArtifactStubFactory getArtifactStubFactory()
+    {
+        return artifactStubFactory;
+    }
+    
     /**
      * Get the generated report as file in the test maven project.
      *
@@ -187,6 +187,14 @@ public abstract class AbstractProjectInfoTestCase
     {
         AbstractProjectInfoReport mojo = (AbstractProjectInfoReport) lookupMojo( goal, pluginXmlFile
);
         assertNotNull( "Mojo found.", mojo );
+        
+        LegacySupport legacySupport = lookup( LegacySupport.class );
+        legacySupport.setSession( newMavenSession( new MavenProjectStub() ) );
+        DefaultRepositorySystemSession repoSession =
+            (DefaultRepositorySystemSession) legacySupport.getRepositorySession();
+        repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( artifactStubFactory.getWorkingDir()
) );
+
+        setVariableValueToObject( mojo, "session", legacySupport.getSession() );
 
         setVariableValueToObject( mojo, "remoteRepositories", mojo.project.getRemoteArtifactRepositories()
);
         return mojo;
@@ -197,11 +205,14 @@ public abstract class AbstractProjectInfoTestCase
     {
         mojo.execute();
 
-        MavenProjectBuilder builder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE
);
-        ProfileManager profileManager = new DefaultProfileManager( getContainer(), null,
null );
+        ProjectBuilder builder = lookup( ProjectBuilder.class );
+        ProfileManager profileManager = new DefaultProfileManager( getContainer(), null );
+        
+        ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
+        buildingRequest.setRepositorySession( null );
 
         assertNotNull( "Local repository", mojo.localRepository );
-        testMavenProject = builder.buildWithDependencies( pluginXmlFile, mojo.localRepository,
profileManager );
+        testMavenProject = builder.build( pluginXmlFile, buildingRequest ).getProject();
 
         File outputDir = mojo.getReportOutputDirectory();
         String filename = mojo.getOutputName() + ".html";
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 402422d..25cbe2d 100644
--- a/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java
+++ b/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java
@@ -48,6 +48,8 @@ public class DependencyConvergenceReportTest
     public void testReport()
         throws Exception
     {
+        getArtifactStubFactory().createArtifact( "junit", "junit", "3.8.1" );
+
         generateReport( "dependency-convergence", "dependency-convergence-plugin-config.xml"
);
         assertTrue( "Test html generated", getGeneratedReport( "dependency-convergence.html"
).exists() );
 
diff --git a/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java
index 7bc8df9..f4577ea 100644
--- a/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java
+++ b/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java
@@ -22,6 +22,7 @@ package org.apache.maven.report.projectinfo;
 import java.io.File;
 import java.lang.reflect.Field;
 import java.net.URL;
+import java.util.Collections;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.report.projectinfo.stubs.SubProject1Stub;
@@ -33,8 +34,6 @@ import com.meterware.httpunit.WebConversation;
 import com.meterware.httpunit.WebRequest;
 import com.meterware.httpunit.WebResponse;
 
-import edu.emory.mathcs.backport.java.util.Collections;
-
 /**
  * @author ltheussl
  * @version $Id$
diff --git a/src/test/java/org/apache/maven/report/projectinfo/stubs/DependencyArtifactStubFactory.java
b/src/test/java/org/apache/maven/report/projectinfo/stubs/DependencyArtifactStubFactory.java
new file mode 100644
index 0000000..7edbadb
--- /dev/null
+++ b/src/test/java/org/apache/maven/report/projectinfo/stubs/DependencyArtifactStubFactory.java
@@ -0,0 +1,74 @@
+package org.apache.maven.report.projectinfo.stubs;
+
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.plugin.testing.ArtifactStubFactory;
+
+public class DependencyArtifactStubFactory
+    extends ArtifactStubFactory
+{
+    private boolean flattenedPath = true;
+
+    public DependencyArtifactStubFactory( File theWorkingDir, boolean theCreateFiles, boolean
flattenedPath )
+    {
+        this( theWorkingDir, theCreateFiles );
+        this.flattenedPath = flattenedPath;
+    }
+
+    public DependencyArtifactStubFactory( File theWorkingDir, boolean theCreateFiles )
+    {
+        super( theWorkingDir, theCreateFiles );
+    }
+
+    @Override
+    public Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange,
String scope,
+                                    String type, String classifier, boolean optional )
+        throws IOException
+    {
+        File workingDir = getWorkingDir();
+
+        if ( !flattenedPath )
+        {
+            StringBuilder path = new StringBuilder( 128 );
+
+            path.append( groupId.replace( '.', '/' ) ).append( '/' );
+
+            path.append( artifactId ).append( '/' );
+
+            path.append( ArtifactUtils.toSnapshotVersion( versionRange.getRecommendedVersion().toString()
) );
+
+            // don't use flatten directories, won't happen at runtime
+            setWorkingDir( new File( workingDir, path.toString() ) );
+        }
+
+        Artifact artifact =
+            super.createArtifact( groupId, artifactId, versionRange, scope, type, classifier,
optional );
+
+        setWorkingDir( workingDir );
+
+        return artifact;
+    }
+}
diff --git a/src/test/resources/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.xml
b/src/test/resources/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.xml
deleted file mode 100644
index 8080ad5..0000000
--- a/src/test/resources/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<plexus>
-  <components>
-    <component>
-      <role>org.codehaus.plexus.i18n.I18N</role>
-      <implementation>org.codehaus.plexus.i18n.DefaultI18N</implementation>
-      <configuration>
-        <default-bundle-name>project-info-reports</default-bundle-name>
-      </configuration>
-    </component>
-  </components>
-</plexus>
\ No newline at end of file

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

Mime
View raw message