Locked SNAPSHOT version ignored
-------------------------------

         Key: MNG-2323
         URL: http://jira.codehaus.org/browse/MNG-2323
     Project: Maven 2
        Type: Bug

  Components: Dependencies  
    Versions: 2.0.4    
    Reporter: Joerg Schaible
    Priority: Critical


We use for our tip revision (head revision of a branch) a snapshot version in 
the form of:

_major.minor-SNAPSHOT_

If we make a (maintenance) release, we create a version like:

_major.minor.revision_

We manage our dependencies in a dependencyManagement section of a super POM, 
where we define always the last released version of an artifact. A dependency 
of an artifact that is always declared without explicit version unless it makes 
usage of an unreleased version, then the child POM will be changed from

{code:xml}
<dependency>
  <groupId>group</group>
  <artifactId>artifact</artifactId>
<dependency>
{code}

to 

{code:xml}
<dependency>
  <groupId>group</group>
  <artifactId>artifact</artifactId>
  <version>major.minor-SNAPSHOT</version>
<dependency>
{code}

Unfortunately this does not work, Maven still prefers the released version. 
Here in the example 2.0.0 instead of 2.0.-SNAPSHOT (snippet):

{noformat}
[INFO] [eclipse:eclipse]
[DEBUG] com.elsagsolutions.projects.components:es_logging:jar:1.0-SNAPSHOT 
(selected for null)
[DEBUG]   com.elsagsolutions.commons:es_commons_test:jar:2.0-SNAPSHOT:test 
(applying version: 2.0.0;applying scope: test)
[DEBUG]   com.elsagsolutions.commons:es_commons_test:jar:2.0.0:test (selected 
for test)
[DEBUG]     cglib:cglib-nodep:jar:2.1_3:test (applying version: 2.1_3;)
[DEBUG]     cglib:cglib-nodep:jar:2.1_3:test (selected for test)
{noformat}

But it gets worse. Even if we try to lock the version in the child POM, it does 
not work; the locked version is happily ignored:

{code:xml}
<dependency>
  <groupId>group</group>
  <artifactId>artifact</artifactId>
  <version>[major.minor-SNAPSHOT]</version>
<dependency>
{code}

Output from the example:

{noformat}
[INFO] [eclipse:eclipse]
[DEBUG] com.elsagsolutions.projects.components:es_logging:jar:1.0-SNAPSHOT 
(selected for null)
[DEBUG]   com.elsagsolutions.commons:es_commons_test:jar:2.0-SNAPSHOT:test 
(setting version to: 2.0-SNAPSHOT from range: [2.0-SNAPSHOT,2.0-SNAPSHOT])
[DEBUG]   com.elsagsolutions.commons:es_commons_test:jar:2.0-SNAPSHOT:test 
(applying version: 2.0.0;applying scope: test)
[DEBUG]   com.elsagsolutions.commons:es_commons_test:jar:2.0.0:test (selected 
for test)
[DEBUG]     cglib:cglib-nodep:jar:2.1_3:test (applying version: 2.1_3;)
[DEBUG]     cglib:cglib-nodep:jar:2.1_3:test (selected for test)
{noformat}

First problem is, that 2.0.x is treated as nearer as 2.0-SNAPSHOT. This is IMHO 
wrong. The algorithm should look, at which point in the version numbering the 
SNAPSHOT part starts and ignore the further numbers in the version of released 
artifacts. Additionally the locked version must be honored in any case.

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