You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2015/12/26 23:29:44 UTC

svn commit: r1721764 - in /maven/plugins/branches/MPIR-251: ./ src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java

Author: michaelo
Date: Sat Dec 26 22:29:44 2015
New Revision: 1721764

URL: http://svn.apache.org/viewvc?rev=1721764&view=rev
Log:
[MPIR-251] Artifact ###### has no file error regression

DependenciesRederer#hasSealed implicitly resolved artifact to files and stopped at the first sealed artifact. Subsequent artifacts had no files attached. #hasSealed has been reduced to test for sealed only and a new method resolveArtifacts has been extracted from the previous source.

Added:
    maven/plugins/branches/MPIR-251/   (props changed)
      - copied from r1721756, maven/plugins/trunk/maven-project-info-reports-plugin/
Modified:
    maven/plugins/branches/MPIR-251/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java

Propchange: maven/plugins/branches/MPIR-251/
------------------------------------------------------------------------------
    bugtraq:logregex = MPIR-\d+

Propchange: maven/plugins/branches/MPIR-251/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Propchange: maven/plugins/branches/MPIR-251/
------------------------------------------------------------------------------
    bugtraq:warnifnoissue = false

Propchange: maven/plugins/branches/MPIR-251/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec 26 22:29:44 2015
@@ -0,0 +1,10 @@
+.wtpmodules
+*.ipr
+cobertura.ser
+.classpath
+*.iws
+.project
+target
+bin
+.settings
+*.iml

Propchange: maven/plugins/branches/MPIR-251/
------------------------------------------------------------------------------
    svn:mergeinfo = /maven/plugins/branches/MPIR-279:1636164-1639524

Modified: maven/plugins/branches/MPIR-251/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MPIR-251/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java?rev=1721764&r1=1721756&r2=1721764&view=diff
==============================================================================
--- maven/plugins/branches/MPIR-251/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java (original)
+++ maven/plugins/branches/MPIR-251/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java Sat Dec 26 22:29:44 2015
@@ -504,6 +504,8 @@ public class DependenciesRenderer
         List<Artifact> alldeps = dependencies.getAllDependencies();
         Collections.sort( alldeps, getArtifactComparator() );
 
+        resolveAtrifacts( alldeps );
+
         // i18n
         String filename = getI18nString( "file.details.column.file" );
         String size = getI18nString( "file.details.column.size" );
@@ -1243,6 +1245,57 @@ public class DependenciesRenderer
         endTable();
     }
 
+    /**
+     * Resolves all given artifacts with {@link RepositoryUtils}.
+     *
+     ** @param artifacts not null
+     */
+    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 ( ArtifactResolutionException e )
+                {
+                    log.error( "Artifact " + artifact.getId() + " can't be resolved.", e );
+                    continue;
+                }
+                catch ( ArtifactNotFoundException 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() + " not found.", e );
+                    }
+
+                    continue;
+                }
+
+                if ( artifact.getFile() == null )
+                {
+                    log.error( "Artifact " + artifact.getId() + " has no file, even after resolution." );
+                }
+            }
+        }
+    }
+
     private Object invoke( Object object, String method )
         throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
     {
@@ -1469,48 +1522,7 @@ public class DependenciesRenderer
     {
         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 ( ArtifactResolutionException e )
-                {
-                    log.error( "Artifact " + artifact.getId() + " can't be resolved.", e );
-                    continue;
-                }
-                catch ( ArtifactNotFoundException 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() + " not found.", e );
-                    }
-
-                    continue;
-                }
-
-                if ( artifact.getFile() == null )
-                {
-                    log.error( "Artifact " + artifact.getId() + " has no file, even after resolution." );
-                    continue;
-                }
-            }
-
-            if ( JAR_SUBTYPE.contains( artifact.getType().toLowerCase() ) )
+            if ( artifact.getFile() != null && JAR_SUBTYPE.contains( artifact.getType().toLowerCase() ) )
             {
                 try
                 {