[ 
http://jira.codehaus.org/browse/MPIR-181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=240994#action_240994
 ] 

Karl M. Davis commented on MPIR-181:
------------------------------------

For what it's worth, that code has changed some now and has some other 
problems. Here's the new code (taken from the [Source 
Xref|http://maven.apache.org/plugins/maven-project-info-reports-plugin/xref/org/apache/maven/report/projectinfo/dependencies/Dependencies.html#302]):
{noformat}
302     private void mapArtifactFiles( DependencyNode node, Map projectMap )
303     {
304         List childs = node.getChildren();
305         if ( ( childs == null ) || childs.isEmpty() )
306         {
307             return;
308         }
309 
310         Iterator it = childs.iterator();
311         while ( it.hasNext() )
312         {
313             DependencyNode anode = (DependencyNode) it.next();
314             String key = ArtifactUtils.versionlessKey( anode.getArtifact() 
);
315             Artifact projartifact = (Artifact) projectMap.get( key );
316             if ( projartifact != null )
317             {
318                 anode = new DependencyNode( ArtifactUtils.copyArtifact( 
projartifact ) );
319                 anode.getArtifact().setFile( projartifact.getFile() );
320             }
321 
322             mapArtifactFiles( anode, projectMap );
323         }
324     }
{noformat}

Line 318 appears to have been added to address this bug. However, this is just 
a local reassignment and leaves the "real" {{anode}} in the dependency tree 
as-is. Because of this, the "real" node in the tree never gets its file set. 
This floods the log with errors as follows:
{noformat}
[ERROR] Artifact: foo:bar:1.0 has no file.
{noformat}

Furthermore, the local reassignment doesn't bring along the "real" node's 
children, which prevents this code from properly recursing through the tree.

(I noticed these problems while trying to track down the cause of those log 
errors on one of my builds. If you ever run {{site:site}} with {{-X}}, the 
amount of these that get generated is crazy.)

> Dependency reporting plugin overwrites other project's artifact file
> --------------------------------------------------------------------
>
>                 Key: MPIR-181
>                 URL: http://jira.codehaus.org/browse/MPIR-181
>             Project: Maven 2.x Project Info Reports Plugin
>          Issue Type: Bug
>         Environment: Linux
>            Reporter: blaabloo
>
> Projectmap is map of artifacts with groupid:artifactid being the key. When 
> project has multiple artifacts only one of them is put to the map. Dependency 
> node contains information about artifact and file information is the same 
> reference as used DefaultLifecycleExecutor. Every dependency's file is set 
> from this map and when building multimodule projects the latter projects may 
> fail because project's default artifact file is set to one of its attached 
> artifacts.
> In org.apache.maven.report.projectinfo.dependencies.Dependencies
> private void mapArtifactFiles( DependencyNode node, Map projectMap )
>     {
>         List childs = node.getChildren();
>         if ( ( childs == null ) || childs.isEmpty() )
>         {
>             return;
>         }
>         Iterator it = childs.iterator();
>         while ( it.hasNext() )
>         {
>             DependencyNode anode = (DependencyNode) it.next();
>             String key = ArtifactUtils.versionlessKey( anode.getArtifact() );
>             Artifact projartifact = (Artifact) projectMap.get( key );
>             if ( projartifact != null )
>             {
>                 anode.getArtifact().setFile( projartifact.getFile() );
>             }
>             mapArtifactFiles( anode, projectMap );
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to