- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 maven-deploy-plugin 将发布和快照上传到 Nexus 存储库。但是我遇到了这个错误
[INFO] [deploy:deploy {execution: default-deploy}]
[INFO] Retrieving previous build number from nexus
Uploading: http://localhost:8081/nexus/content/repositories/snapshots/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120605.140242-20.jar
56K uploaded (edr-app-1.0.4-20120605.140242-20.jar)
[INFO] Uploading project information for edr-app 1.0.4-20120605.140242-20
[INFO] Retrieving previous metadata from nexus
[INFO] Uploading repository metadata for: 'artifact info.afilias.edr:edr-app'
[INFO] Retrieving previous metadata from nexus
[INFO] Uploading repository metadata for: 'snapshot info.afilias.edr:edr-app:1.0.4-SNAPSHOT'
[INFO] Retrieving previous build number from nexus
Uploading: http://localhost:8081/nexus/content/repositories/snapshots/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120605.140242-20.tar.gz
4286K uploaded (edr-app-1.0.4-20120605.140242-20.tar.gz)
[INFO] [deploy:deploy-file {execution: default}]
Uploading: http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4/edr-app-1.0.4.tar.gz
89530K uploaded (edr-app-1.0.4.tar.gz)
[INFO] Uploading project information for edr-app 1.0.4
[INFO] Retrieving previous metadata from remote-repository
[INFO] Uploading repository metadata for: 'artifact info.afilias.edr:edr-app'
[INFO] Retrieving previous build number from remote-repository
[INFO] repository metadata for: 'snapshot info.afilias.edr:edr-app:1.0.4-SNAPSHOT' could not be found on repository: remote-repository, so will be created
Uploading: http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120605.140242-20.tar.gz
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error deploying attached artifact /home/mren/trunk2/target/edr-app-1.0.4-SNAPSHOT.tar.gz: Error deploying artifact: Failed to transfer file: http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120605.140242-20.tar.gz. Return code is: 400
这是我在 pom.xml 中的配置:
<project>
...
<distributionManagement>
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
...
<build>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file>target/edr-install-1.0.4-${revision}.tar.gz</file>
<url>${project.distributionManagement.repository.url}</url>
<packaging>tar.gz</packaging>
<artifactId>artifactId</artifactId>
<groupId>groupId</groupId>
<version>1.0.4-${revision}</version>
</configuration>
</execution>
</executions>
</plugin>
...
</build>
...
</project>
从我的 settings.xml 文件中:
<settings>
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<profiles>
<profile>
<id>nexus</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<name>Snapshots</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
</settings>
我确定此配置曾经有效,但现在它吐出一个错误。不确定哪里出了问题。
nexus 日志告诉我它正在尝试将快照上传到发布存储库
jvm 1 | 2012-06-04 14:16:31 INFO [tp1706427008-35] - org.sonatype.nexus.proxy.maven.maven2.M2Repository - Storing of item releases:/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120604.181534-1.tar.gz is forbidden by Maven Repository policy. Because releases is a RELEASE repository
jvm 1 | 2012-06-04 14:16:31 ERROR [tp1706427008-35] - org.sonatype.nexus.rest.ContentPlexusResource - Got exception during processing request "PUT http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120604.181534-1.tar.gz": Storing of item releases:/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120604.181534-1.tar.gz is forbidden by Maven Repository policy. Because releases is a RELEASE repository
最佳答案
您的 settings.xml 不正确。请配置 Maven 以使用 Nexus correctly following the book chapter.具体使用镜像设置和其中的 url,而不是存储库和 pluginRepository 的特定 url。
它会干扰您正确的 Maven pom,并最终尝试将快照部署到发布存储库中,这是不正确的。
此外,使用正确的目标/命令也很重要。不要直接使用 deploy-file 目标。
直接运行命令
mvn clean deploy
正在构建中。
还有一个澄清。 Maven 将部署根据版本确定的任何内容。如果它以 -SNASPHOT 结尾,则它是一个开发版本并被发布到快照存储库(并将允许重新部署增加版本号),如果不是,则它被认为是一个发布并将部署到发布存储库。一个项目不能同时是快照和发布。这是一个或另一个。
不要混淆release和snapshot这两个概念!
在部署额外的 Artifact 方面,如果它们没有关联,或者如果它们正在查看构建助手插件的附加 Artifact 目标,我会将它们拉出到一个单独的项目/模块中。
关于maven - 为什么 Maven 会错误地上传快照以发布存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10884714/
我有以下正则表达式 /[a-zA-Z0-9_-]/ 当字符串只包含从 a 到z 大小写、数字、_ 和 -。 我的代码有什么问题? 能否请您向我提供一个简短的解释和有关如何修复它的代码示例? //var
我是一名优秀的程序员,十分优秀!