[jira] Issue Comment Edited: (MRELEASE-454) The Release-Plugin does not rewrite dependencies in the DependencyManagement with scope import
[ http://jira.codehaus.org/browse/MRELEASE-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=247472#action_247472 ] Pedro Rodriguez edited comment on MRELEASE-454 at 12/22/10 10:41 AM: - The rewriteDependencies method was rewritten to use raw dependency definitions directly from the pom xml. Only dependencies found in the pom xml document are processed. However, it was required to interpolate the groupId, artifactId and version in the xml in order to compare with the resolved dependencies. Regarding the MRELEASE-412 issue while updating properties during the rewrite-poms-for-development phase, we only observed that in the case of a dependency management import and it was fixed. New unit tests: One additional rewrite-for-release unit test was added imported-dependency-management-in-reactor Two additional rewrite-poms-for-development unit tests were added: pom-with-parent-and-properties-in-dependency-management pom-with-parent-and-properties-in-dependency-management-import Persistent issue Maven (2.2.1) always resolves imported dependencyManagement from the repository, ignoring the reactor. Also, Maven does not recognize the imported dependencyManagement pom as a dependency so the reactor order is broken. The workaround we use for that is: 1) Manually order the modules to ensure that dependencyManagement imported POM gets built before the importing module. 2) Execute release:prepare with preparationGoals install to ensure that the imported POM can be resolved from the repository during the importing module build. Note: In the new Unit Tests we have added for dependency-management-import we bypassed these issues making available the required artifacts in the test repository. There is already a JIRA open for this: MNG-4052. MNG-4052: import scope dependencies prefer to download pom rather than find it in the current project This issue appears currently closed by it was fixed in 3.0-alpha-3 version. However, the current development version (2.2-SNAPSHOT) of the maven-release-plugin uses Maven 2.0.9. Next (Question): How do we plan to upgrade the plugins to Maven 3? Are we going to create a new release branch for the Maven 3 development? ... maven-release-plugin development version 3.0-SNAPSHOT was (Author: prodriguez): 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
[jira] Updated: (MRELEASE-454) The Release-Plugin does not rewrite dependencies in the DependencyManagement with scope import
[ http://jira.codehaus.org/browse/MRELEASE-454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pedro Rodriguez updated MRELEASE-454: - Attachment: MRELEASE-454.patch This is the complete patch containing both changes and unit tests Please, ignore MRELEASE-454.diff 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 Attachments: MRELEASE-454.diff, MRELEASE-454.patch 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. dependencyManagement dependencies dependency groupIddist/groupId artifactIddeps/artifactId typepom/type version4.0.4-SNAPSHOT/version scopeimport/scope /dependency /dependencies /dependencyManagement -- 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
[jira] Commented: (MRELEASE-412) release:prepare does not update properties during rewrite-poms-for-development phase.
[ http://jira.codehaus.org/browse/MRELEASE-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=249463#action_249463 ] Pedro Rodriguez commented on MRELEASE-412: -- The unit tests couldnt show it because the problem occurs at the integration level of the release phases. The rewrite-poms-for-release phase changed the property only in the xml. During the rewrite-poms-for-development, the new xml (with the release version value) get parsed. However, the same unchanged reactor project (with the previous development property value) is used. The development version is not set during the rewrite-poms-for-development phase because the value of the property in the xml is not the same that in the project model. Fix: The project model needs to be updated when we change a property value. We have fixed this issue at the same time that the MRELEASE-454 release:prepare does not update properties during rewrite-poms-for-development phase. - Key: MRELEASE-412 URL: http://jira.codehaus.org/browse/MRELEASE-412 Project: Maven 2.x Release Plugin Issue Type: Bug Components: prepare Affects Versions: 2.0-beta-8 Environment: Maven version: 2.0.10-RC8 Java version: 1.5.0_14 OS name: linux version: 2.6.28.4 arch: i386 Family: unix Reporter: Christian Schulte Priority: Blocker Attachments: MRELEASE-412.patch When a dependency version is specified using a property like ${someExpression} that property is correctly updated during the rewrite-poms-for-release phase but not during the rewrite-poms-for-development phase. The attached patch solves this for me. -- 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
[jira] Updated: (MRELEASE-454) The Release-Plugin does not rewrite dependencies in the DependencyManagement with scope import
[ http://jira.codehaus.org/browse/MRELEASE-454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pedro Rodriguez updated MRELEASE-454: - Attachment: MRELEASE-412_and_MRELEASE-454.patch This is the patch file to fix MRELEASE-412 and MRELEASE-454 Please, ignore the previous MRELEASE-454.path 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 Attachments: MRELEASE-412_and_MRELEASE-454.patch, MRELEASE-454.diff, MRELEASE-454.patch 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. dependencyManagement dependencies dependency groupIddist/groupId artifactIddeps/artifactId typepom/type version4.0.4-SNAPSHOT/version scopeimport/scope /dependency /dependencies /dependencyManagement -- 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
[jira] Updated: (MRELEASE-454) The Release-Plugin does not rewrite dependencies in the DependencyManagement with scope import
[ http://jira.codehaus.org/browse/MRELEASE-454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pedro Rodriguez updated MRELEASE-454: - Attachment: MRELEASE-454.diff A diff file with the documented changes to fix 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 Attachments: MRELEASE-454.diff 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. dependencyManagement dependencies dependency groupIddist/groupId artifactIddeps/artifactId typepom/type version4.0.4-SNAPSHOT/version scopeimport/scope /dependency /dependencies /dependencyManagement -- 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
[jira] Commented: (MRELEASE-454) The Release-Plugin does not rewrite dependencies in the DependencyManagement with scope import
[ http://jira.codehaus.org/browse/MRELEASE-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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. dependencyManagement dependencies dependency groupIddist/groupId artifactIddeps/artifactId typepom/type version4.0.4-SNAPSHOT/version scopeimport/scope /dependency /dependencies /dependencyManagement -- This message is automatically
[jira] Created: (MRELEASE-602) Repositories defined in a profile are ignored while processing dependency management pom imports in a pom resolved from the repository
Repositories defined in a profile are ignored while processing dependency management pom imports in a pom resolved from the repository -- Key: MRELEASE-602 URL: http://jira.codehaus.org/browse/MRELEASE-602 Project: Maven 2.x Release Plugin Issue Type: Bug Components: prepare Affects Versions: 2.0 Reporter: Pedro Rodriguez We define the repositories in a profile. The dependency management resolution fails to resolve a pom import if the import occurs in an imported pom not found in the reactor. The following code fragment shows the problem: While merging managed dependencies of a dependency resolved from the repository, the ProjectBuilderConfiguration that is used do not contain the ProfileManager. Class: org.apache.maven.project.DefaultMavenProjectBuilder mergeManagedDependencies(...) ... if ( dep.getType().equals( pom ) Artifact.SCOPE_IMPORT.equals( dep.getScope() ) ) { Artifact artifact = artifactFactory.createProjectArtifact( dep.getGroupId(), dep.getArtifactId(), dep.getVersion(), dep.getScope() ); MavenProject project = buildFromRepository(artifact, parentSearchRepositories, localRepository, false); DependencyManagement depMgmt = project.getDependencyManagement(); ... buildFromRepository(...) ... Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository, allowStubModel ); ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository ); return buildInternal( Artifact [ + artifact + ], model, config, remoteArtifactRepositories, null, false ); buildInternal( ... ) ... ProfileManager externalProfileManager = config.getGlobalProfileManager(); ... Set aggregatedRemoteWagonRepositories = new LinkedHashSet(); List activeExternalProfiles; if ( externalProfileManager != null ) { activeExternalProfiles = externalProfileManager.getActiveProfiles(); } else { activeExternalProfiles = Collections.EMPTY_LIST; } for ( Iterator i = activeExternalProfiles.iterator(); i.hasNext(); ) { Profile externalProfile = (Profile) i.next(); for ( Iterator repoIterator = externalProfile.getRepositories().iterator(); repoIterator.hasNext(); ) { Repository mavenRepo = (Repository) repoIterator.next(); ArtifactRepository artifactRepo = artifactRepo = ProjectUtils.buildArtifactRepository( mavenRepo, artifactRepositoryFactory, container ); aggregatedRemoteWagonRepositories.add( artifactRepo ); } } Because the GlobalProfileManager was not specified in the DefaultProjectBuilderConfiguration, the activeExternalProfiles list is empty and all remote repositories are ignored. In general, the ProjectBuilderConfiguration is created with a factory method which correctly set the GlobalProfileManager. org.apache.maven.execution.DefaultMavenExecutionRequest public ProjectBuilderConfiguration getProjectBuilderConfiguration() { ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration(); config.setLocalRepository( getLocalRepository() ) .setGlobalProfileManager( getGlobalProfileManager() ) .setExecutionProperties( getExecutionProperties() ) .setUserProperties( getUserProperties() ) .setBuildStartTime( startTime ); return config; } -- 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