2

I'm trying to use the Maven Versions plugin but am blocked by an issue that is causing the plugin to not locate release artefacts in the company release artefact repository. A section of a test POM that demonstrates the issue ...

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.xxxx.sage</groupId>
            <artifactId>sage-core-health</artifactId>
            <version>1.36-SNAPSHOT</version>
        </dependency>
    </dependencies>
</dependencyManagement>

<repositories>
    <repository>
        <id>releases</id>
        <url>http://releases.dev.xxxx.org/archiva/repository/releases</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>

If I execute versions:force-releases, the artefact version number is not updated. Maven logs the following ...

[DEBUG] Looking for a release of org.xxxx.sage:sage-core-health:jar:1.36-SNAPSHOT
[DEBUG] Skipping update check for artifact org.xxxx.sage:sage-core-health (C:\Users\williams\.m2\repository\org\xxxx\sage\sage-core-health\maven-metadata-releases.xml) from disabled repository releases (http://releases.dev.xxxx.org/archiva/repository/releases)
[DEBUG] Skipping update check for artifact org.xxxx.sage:sage-core-health (C:\Users\williams\.m2\repository\org\xxxx\sage\sage-core-health\maven-metadata-central.xml) from disabled repository central (https://repo.maven.apache.org/maven2)
[INFO] No release of org.xxxx.sage:sage-core-health:jar:1.36-SNAPSHOT to force.

Version 1.36 is definitely in the release artefact repository. If I change the repository definition to enable snapshots and execute the same goal, the artefact version number is correctly updated to 1.36.

I've been trying to get this plugin working for days but it only seems to locate release artefacts in the release artefact repository when I enable it for SNAPSHOTs ...

<repositories>
    <repository>
        <id>releases</id>
        <url>http://releases.dev.xxxx.org/archiva/repository/releases</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>

What am I doing wrong?

Thanks

1 Answers1

1

This happens because your company artifact is a SNAPSHOT version so Maven by default looks in the configured snapshot repository for the latest snapshot version. In order to properly look in the releases repository, remove SNAPSHOT from your artifact version and Maven will default to looking in the releases repository. Maven determines which repository to look for using the version and if it contains "SNAPSHOT" it will use the snapshot repository.

jon5477
  • 520
  • 6
  • 17