You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Steffi Tinder (JIRA)" <ji...@codehaus.org> on 2011/01/19 13:57:58 UTC

[jira] Commented: (MRELEASE-634) Versions of snapshot dependencies to the same artifact with different classifiers are not updated correctly during release:prepare

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

Steffi Tinder commented on MRELEASE-634:
----------------------------------------

Additional information to the patch I have attached (continue-after-rewriting.patch): It solves the issue for us. I have no idea if there are side-effects, that need to be considered for an elegant solution. In fact, the patch only fixes part two of the problem mentioned in my initial comment, but this is enough in our scenario. Part one only is a problem if the dependencies need to be set to different versions or if anyone is annoyed by being asked to enter release and development versions for the same dependency multiple times.

> 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
>         Attachments: continue-after-rewriting.patch
>
>
> 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