1

I have a project A which needs AAA:BBB as a dependency.

<dependency>
    <groupId>AAA</groupId>
    <artifactId>BBB</artifactId>
    <version>RELEASE</version>
</dependency>

After deploying a branch version(say, 0.2.1-4) of AAA:BBB, release version number is the latest deployed version number (0.2.1-4), not the HIGHEST number(0.3.3).

maven-metadata.xml:

<metadata>
    <groupId>AAA</groupId>
    <artifactId>BBB</artifactId>
    <versioning>
        <latest>0.3.3</latest>
        <release>**0.2.1-4**</release>
        <versions>
            <version>0.1.0</version>
            <version>0.1.0-1</version>
            <version>0.1.0-2</version>
            <version>0.2.1</version>
            <version>0.2.1-3</version>
            <version>0.3.1</version>
            <version>0.3.3</version>
            <version>**0.2.1-4**</version>
        </versions>
        <lastUpdated>20130628092226</lastUpdated>
    </versioning>
</metadata>

Therefore when building project A, the RELEASE version number of AAA:BBB will be resolved to 0.2.1-4, not 0.3.3, which causes the build failed.

Only after ***rebuiling metadata via Sonatype nuxus UI*** can we have the HIGHEST version number.


maven-metadata.xml with sorted version number after rebuilding metadata:
<metadata>
    <groupId>AAA</groupId>
    <artifactId>BBB</artifactId>
    <versioning>
        <latest>0.3.3</latest>
        <release>**0.3.3**</release>
        <versions>
            <version>0.1.0</version>
            <version>0.1.0-1</version>
            <version>0.1.0-2</version>
            <version>0.2.1</version>
            <version>0.2.1-3</version>
            <version>0.2.1-4</version>
            <version>0.3.1</version>
            <version>**0.3.3**</version>
        </versions>
        <lastUpdated>20130628092226</lastUpdated>
    </versioning>
</metadata>



Is it possible to update maven-metadata.xml's RELEASE VERSION to HIGHEST VERSION number after deploying an artifact?


Thanks.

Mohammad Faisal
  • 5,783
  • 15
  • 70
  • 117
  • What would you like to achieve, cause all the versions are released so where is the problem? Are you using a repository manager ? Or what causes exactly problems? – khmarbaise Jun 28 '13 at 10:21
  • I am using sonatype nexus repository manager. If the RELEASE version is not the highest version number(ex.branch version), we will fetch the wrong version number if the dependency version is set to RELEASE. Therefore I want to guarantee that the RELEASE version is always the HIGHEST version. – user2181574 Jul 01 '13 at 01:46
  • Why are you settings the version to `RELEASE` version? Which Maven version do you use? Do you mean `version number (ex.branch version)` and template for your version number`? Can you shown an example of that? Does it follow the [version schema](http://mojo.codehaus.org/versions-maven-plugin/version-rules.html)? Are the above examples from Nexus or from a local repository? – khmarbaise Jul 01 '13 at 20:07
  • 1. Setting RELEASE version saves the effort of checking what the latest number is. 2. I am using maven 2.2.1. 3.Version number. 4. The original post has been edited to elaborate the example. 5. No. I consider the build number as another incremental version number for branch version.
    6..The above example is from Nexus.
    – user2181574 Jul 02 '13 at 02:15

0 Answers0