Maven版本插件跳过更新检查

时间:2012-06-25 16:12:26

标签: maven maven-3 nexus

当我尝试使用versions:use-releases时,我的发布存储库被标记为“已禁用”,这意味着快照依赖项无法解析为发布。我不明白为什么存储库被视为禁用。

以下是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/)

我运行一个设置,将central的请求镜像到我们的Nexus实例,并且还指定了一个全局快照存储库:

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

存在相关依赖项的发行版和快照版,并且存储库在所有其他方面与预期完全一致。

2 个答案:

答案 0 :(得分:3)

您的settings.xml文件应配置为as documented in the Nexus book。你的配置不会起作用,因为它只能部分覆盖Maven的超级pom。

答案 1 :(得分:1)

我也碰到了这个。通过这样做我能够超越它:

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

与之前的情况有所不同:

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

当Maven查找当前工件的元数据时,似乎会发生这种情况,并将其搜索限制为仅包含该工件的repos。