6
votes

When I attempt to use versions:use-releases my release repository is marked as "disabled", meaning the snapshot dependencies do not get resolved to releases. I don't understand why the repository is considered disabled.

Here is the abbreviated debug output from the build:

[DEBUG]   (f) remoteArtifactRepositories = [       id: snapshots
      url: http://maven.live.hostname.net/content/repositories/snapshots/
   layout: default
snapshots: [enabled => true, update => daily]
 releases: [enabled => true, update => daily]
,        id: company-nexus
      url: http://maven.live.hostname.net/content/groups/public/
   layout: default
snapshots: [enabled => false, update => daily]
 releases: [enabled => true, update => daily]
]
[...]
[DEBUG] Looking for a release of promotion-test-central:promotion-test-central:jar:1.6.0-SNAPSHOT
[INFO] artifact promotion-test-central:promotion-test-central: checking for updates from snapshots
[DEBUG] Reading resolution-state from: /home/tester/.m2/repository/promotion-test-central/promotion-test-central/resolver-status.properties
[DEBUG] Writing resolution-state to: /home/tester/.m2/repository/promotion-test-central/promotion-test-central/resolver-status.properties
[DEBUG] Skipping update check for artifact promotion-test-central:promotion-test-central (/home/tester/.m2/repository/promotion-test-central/promotion-test-central/maven-metadata-company-nexus.xml) from disabled repository company-nexus (http://hostname/content/groups/public/)

I run a setup that mirrors requests to central to our Nexus instance, and also specifies a global snapshot repository too:

    <mirrors>
        <mirror>
            <id>mendeley-nexus</id>
            <mirrorOf>central</mirrorOf>
            <url>http://maven.live.chonp.net/content/groups/public/</url>
        </mirror>
    </mirrors>
    <profiles>
        <profile>
            <id>default</id>
            <repositories>
                <repository>
                    <id>snapshots</id>
                    <url>http://maven.live.chonp.net/content/repositories/snapshots/</url>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>default</activeProfile>
    </activeProfiles>

There exists a release and snapshot version of the dependency in question, and the repository works exactly as expected in all other respects.

2
@ZnArK - How does one do the XML syntax highlighting? - EngineerBetter_DJ
for xml you need to add the comment `<!-- language: lang-xml --> SO uses prettify, here's the README google-code-prettify.googlecode.com/svn/trunk/README.html This is also a great resource meta.stackexchange.com/a/75019/187632 - ZnArK
1 up as I had the exact same problem and this answer worked perfect - Pulak Agrawal

2 Answers

3
votes

Your settings.xml file should be configured as documented in the Nexus book. Your configuration wont work since it only partly overrides the super pom of Maven.

1
votes

I also ran into this. I was able to get past it by doing:

    <repository>
        <id>my-snapshots</id>
        <url>https://nexus.corp.company.com/nexus/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>

which was a departure from previously having:

        <releases>
            <enabled>false</enabled>
        </releases>

This seems to happen when Maven looks up the metadata for your current artifact, and limits its search to only repos that could also contain that artifact.