[jira] Commented: (MRELEASE-454) The Release-Plugin does not rewrite dependencies in the DependencyManagement with scope "import"

2010-12-13 Thread Pedro Rodriguez (JIRA)

[ 
http://jira.codehaus.org/browse/MRELEASE-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=247472#action_247472
 ] 

Pedro Rodriguez commented on MRELEASE-454:
--

The problem is that the current code rewrites the dependencies already 
resolved. 

org.apache.maven.shared.release.phase.AbstractRewritePomsPhase, Line 272 

if ( project.getDependencyManagement() != null )
{
Element dependencyRoot = rootElement.getChild( "dependencyManagement", 
namespace );
if ( dependencyRoot != null )
{
rewriteDependencies( 
project.getDependencyManagement().getDependencies(), dependencyRoot,
 mappedVersions, resolvedSnapshotDependencies, 
originalVersions, projectId,
 properties, result, releaseDescriptor );
}
}

A simple fix could be to add the "imported dependency management" dependencies 
to the dependencies list we want to rewrite:

if ( project.getDependencyManagement() != null )
{
Element dependencyRoot = rootElement.getChild( "dependencyManagement", 
namespace );
if ( dependencyRoot != null )
{
List dependencies = new ArrayList( 
project.getDependencyManagement().getDependencies() );

// Add "imported dependencyManagement" to the dependencies list to 
allow them to be rewrited as well   
Element dependencyManagementDependenciesRoot = 
dependencyRoot.getChild("dependencies", namespace);
if( dependencyManagementDependenciesRoot != null ) 
{
List dependencyManagementDependencyElements = 
dependencyManagementDependenciesRoot.getChildren();
for (Iterator iterator = dependencyManagementDependencyElements
.iterator(); iterator.hasNext();) 
{

Element dependencyManagementDependency = (Element) 
iterator.next();

Element groupId = 
dependencyManagementDependency.getChild( "groupId", namespace );
Element artifactId = 
dependencyManagementDependency.getChild( "artifactId", namespace );
Element version = 
dependencyManagementDependency.getChild( "version", namespace );
Element scope = 
dependencyManagementDependency.getChild( "scope", namespace );
Element type = dependencyManagementDependency.getChild( 
"type", namespace );

if( groupId != null && artifactId != null && version != 
null && scope != null && type != null && 
"pom".equals(type.getText()) && 
"import".equals(scope.getText())  ) 
{

Dependency importedDependencyManagement = new 
Dependency();

importedDependencyManagement.setGroupId( 
groupId.getText() );
importedDependencyManagement.setArtifactId( 
artifactId.getText() );
importedDependencyManagement.setVersion( 
version.getText() );
importedDependencyManagement.setType( 
type.getText() );
importedDependencyManagement.setScope( 
scope.getText() );

dependencies.add(importedDependencyManagement);
}
}
}

rewriteDependencies( dependencies, dependencyRoot,
 mappedVersions, resolvedSnapshotDependencies, originalVersions, 
projectId,
 properties, result, releaseDescriptor );
}
}



> The Release-Plugin does not rewrite dependencies in the DependencyManagement 
> with scope "import"
> 
>
> Key: MRELEASE-454
> URL: http://jira.codehaus.org/browse/MRELEASE-454
> Project: Maven 2.x Release Plugin
>  Issue Type: Bug
>  Components: prepare
>Affects Versions: 2.0-beta-9
>Reporter: Jens Mühlenhoff
>
> Add the following node to the pom. Then prepare the release and this section 
> will not be rewriten, because the "imported" entry will not appear in 
> project.getDependencyManagement().getDependencies(). This methode returns all 
> the resolved dependencies. In this situation the transformDocument method 
> from AbstractRewritePomsPhase could not change the given dependencies, 
> because it is not visible to the method.
> 
>   
>   
>   dist
>   deps
>   pom
>   4.0.4-SNAPSHOT
>   import
>   
>   
> 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrat

[jira] Commented: (MRELEASE-454) The Release-Plugin does not rewrite dependencies in the DependencyManagement with scope "import"

2010-12-07 Thread JIRA

[ 
http://jira.codehaus.org/browse/MRELEASE-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=246749#action_246749
 ] 

L. Compère commented on MRELEASE-454:
-

Is there some kind of workaround for this issue?  

> The Release-Plugin does not rewrite dependencies in the DependencyManagement 
> with scope "import"
> 
>
> Key: MRELEASE-454
> URL: http://jira.codehaus.org/browse/MRELEASE-454
> Project: Maven 2.x Release Plugin
>  Issue Type: Bug
>  Components: prepare
>Affects Versions: 2.0-beta-9
>Reporter: Jens Mühlenhoff
>
> Add the following node to the pom. Then prepare the release and this section 
> will not be rewriten, because the "imported" entry will not appear in 
> project.getDependencyManagement().getDependencies(). This methode returns all 
> the resolved dependencies. In this situation the transformDocument method 
> from AbstractRewritePomsPhase could not change the given dependencies, 
> because it is not visible to the method.
> 
>   
>   
>   dist
>   deps
>   pom
>   4.0.4-SNAPSHOT
>   import
>   
>   
> 

-- 
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