我在尝试设置项目以部署到内部联系存储库时目前遇到问题。由于我对整个Maven都比较陌生,因此我认为在如何建立分销管理方面我并没有真正理解的东西。为什么Maven(错误地?)将我的SNAPSHOT部署到版本库和快照库?
基本问题是,当我执行“mvn deploy”时,工件已成功部署到快照存储库,但Maven也试图将其部署到发布存储库,因为它应该是失败的。我对当前配置的理解是,它不应该将其部署到发布存储库。
我已经包含了各种配置元素下方,但如果我其实应该是管理与配置文件中的部分,以便建立快照只定义,并发布版本只定义我想知道。
对此的任何帮助/澄清将不胜感激。
我在我的POM配电管理的以下内容:
<distributionManagement>
<repository>
<id>internal-releases</id>
<name>Internal Releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>internal-snapshots</id>
<name>Internal Snapshots</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
其他地方我有以下设置为允许使用这些存储库中获得文物POM:
<repositories>
<repository>
<id>internal-releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>internal-snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<!-- other repos, etc, etc -->
</repositories>
我在我的settings.xml中有正确的设置来提供证书,以便能够发布到我的计算机上运行的此测试nexus实例,并且实际上它正在成功部署快照。
的问题是,它也试图部署快照释放存储库,它被配置为禁止快照。
从“MVN部署”输出包括以下内容:
[INFO] [deploy:deploy {execution: default-deploy}]
[INFO] Retrieving previous build number from internal-snapshots
Uploading: http://localhost:8081/nexus/content/repositories/snapshots/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-8.war
405K uploaded (service-1.0.0-20101104.170338-8.war)
[INFO] Retrieving previous metadata from internal-snapshots
[INFO] Uploading repository metadata for: 'snapshot com.internal:service:1.0.0-SNAPSHOT'
[INFO] Retrieving previous metadata from internal-snapshots
[INFO] Uploading repository metadata for: 'artifact com.internal:service'
[INFO] Uploading project information for service 1.0.0-20101104.170338-8
[INFO] [deploy:deploy-file {execution: default}]
[INFO] Retrieving previous build number from remote-repository
[INFO] repository metadata for: 'snapshot com.internal:service:1.0.0-SNAPSHOT' could not be found on repository: remote-repository, so will be created
Uploading: http://localhost:8081/nexus/content/repositories/releases/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-1.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error deploying artifact: Failed to transfer file: http://localhost:8081/nexus/content/repositories/releases/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-1.jar. Return code is: 400
Nexus的日志包含以下(因为我希望它):
jvm 1 | 2010-11-04 13:03:39 INFO [p-759477796-118] - o.s.n.p.m.m.M2Repos~ - Storing of item releases:/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-1.jar is forbidden by Maven Repository policy. Because releases is a RELEASE repository
jvm 1 | 2010-11-04 13:03:39 ERROR [p-759477796-118] - o.s.n.r.ContentPlex~ - Got exception during processing request "PUT http://localhost:8081/nexus/content/repositories/releases/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-1.jar": Storing of item releases:/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-1.jar is forbidden by Maven Repository policy. Because releases is a RELEASE repository
的神器版本是1.0.0,快照,因此没有。 – imaginaryboy 2010-11-06 02:52:56
这个答案应该是一个评论,我想 – 2016-03-11 16:11:17