Versions of snapshot dependencies to the same artifact with different 
classifiers are not updated correctly during release:prepare 
-----------------------------------------------------------------------------------------------------------------------------------

                 Key: MRELEASE-634
                 URL: http://jira.codehaus.org/browse/MRELEASE-634
             Project: Maven 2.x Release Plugin
          Issue Type: Bug
          Components: prepare
    Affects Versions: 2.1
            Reporter: Steffi Tinder


If you have several dependencies to the same artifact with different 
classifiers, the versions are not correctly updated by the release-plugin.

Consider the following scenario:

You have the following two dependencies in your pom:  

{code:xml} 
<dependency>
        <groupId>groupid</groupId>
        <artifactId>artifactid/artifactId>
        <version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
        <groupId>groupid</groupId>
        <artifactId>artifactid/artifactId>
        <scope>test</scope>
        <classifier>tests</classifier>
        <version>1.0-SNAPSHOT</version>
</dependency>
{code} 

During release:prepare, the plugin will ask you to enter release and dev 
version for groupid:artifact twice, but it will discard the information you 
entered the first time. 

This happens because the ReleaseManager uses a "versionlessKey" to store the 
resolved snapshot dependencies.

{code:title=org.apache.maven.shared.release.phase.CheckDependencySnapshotsPhase}
private Map processSnapshot( Set snapshotSet )
        throws PrompterException, VersionParseException
{
    ...
    resolvedSnapshots.put( versionlessKey, versionMap );
    ...
}
{code} 

When the version tags in the pom are updated with the new versions, only one of 
the dependencies will be updated. Again, the release-plugin will only use 
groupid and artifactid to identify the dependency. 
It also checks if the dependency was already updated and so the second 
dependency-element is ignored:

{code:title=org.apache.maven.shared.release.phase.CheckDependencySnapshotsPhase}
private void rewriteDependencies( List dependencies, Element dependencyRoot, 
Map mappedVersions,
                                      Map resolvedSnapshotDependencies, Map 
originalVersions, String projectId,
                                      Element properties, ReleaseResult result, 
ReleaseDescriptor releaseDescriptor )
        throws ReleaseExecutionException, ReleaseFailureException
{
    ...
    if ( !dependenciesAlreadyChanged.contains( depId ) )
    {
        //This check is required because updateDomVersion update all 
dependencies with the current groupId/artifactId
        //(standard dependencies and sub-dependencies like ejb-client) so we 
don't need to re-update them
        ...
    }
}
{code} 


*Summary:*

The problem consists of two parts:

1. the version information entered for the second dependency is discarded (that 
means you couldn't specify different versions for the two dependencies)
2. only on of the dependency elements is updated during the release

The result is a remaining SNAPSHOT-dependency in the released artifacts. 

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