maven deploy-file失败,带有503:找不到maven-metadata.xml

时间:2012-06-12 00:34:09

标签: maven deployment nexus maven-metadata

我正在使用Maven将我们的项目与其他人整合,可能是以不受欢迎的方式遇到问题。

我们有一个用于使用Ant编译的项目。 Ant脚本很大很棒,所以当我们使用Maven进行集成时,决定继续使用Ant进行编译。

现在让我们说Ant编译输出是res-1.0-SNAPSHOT.tar.gz。 (任何文件名都可以,但它是tar.gz)我正在将文件部署到一个名为“snapshots”的nexus托管的快照库。

我尝试使用此命令进行部署:

mvn deploy:deploy-file \
  -DgroupId="com.my-company" \
  -DartifactId="res" \
  -Dversion="1.0-SNAPSHOT" \
  -Dpackaging="tar.gz" \
  -Dfile="res-1.0-SNAPSHOT.tar.gz" \
  -Durl="http://our-nexus-ip/nexus/content/repositories/snapshots" \
  -DrepositoryId="snapshots"

我在〜/ .m2中有一个简单的settings.xml,包含代理和服务器设置。但是,服务器设置尚未在当前进度中使用,错误的密码不会出错。

输出如下:

[[root@cnbi maven]# ./run.sh
+ mvn deploy:deploy-file -DgroupId=com.my-company -DartifactId=res -Dversion=1.0-SNAPSHOT -Dpackaging=tar.gz -Dfile=res-1.0-SNAPSHOT.tar.gz -Durl=http://135.252.234.142:8081/nexus/content/repositories/snapshots -DrepositoryId=snapshots
Warning: JAVA_HOME environment variable is not set.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'deploy'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [deploy:deploy-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [deploy:deploy-file]
[INFO] Retrieving previous build number from snapshots
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error retrieving previous build number for artifact 'com.my-company:res:tar.gz': repository metadata for: 'snapshot com.my-company:res:1.0-SNAPSHOT' could not be retrieved from repository: snapshots due to an error: Error transferring file

Server returned HTTP response code: 503 for URL: http://135.252.234.142:8081/nexus/content/repositories/snapshots/com/my-company/res/1.0-SNAPSHOT/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 51 seconds
[INFO] Finished at: Tue Jun 12 08:44:13 CST 2012
[INFO] Final Memory: 7M/209M
[INFO] ------------------------------------------------------------------------

你看,它无法找到maven-metadata.xml。可以肯定的是,存储库中根本不存在文件及其文件夹“com / my-company”。

除了滥用Maven之外你还可以找到,我的问题是:

1)我是否以正确的方式使用Maven? (部署tar.gz,使用deploy:deploy-file ...)

2)参数不正确吗?

3)什么是maven-metadata.xml?它不在那里,但Maven坚持找到它 - 我猜它是生成的,我错过了一些步骤吗?

解决方案可能是愚蠢的,我真的不熟悉Maven。不幸的是,必须要做...请帮助我解决这个问题。

Maven版本是2.0.11。如果您想了解更多信息,请与我们联系。

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,我们的关系中存在一个错误。

使用 maven3 (使用相同的 settings.xml pom.xml .m2 repo)解决了我们的问题问题,比升级nexus更容易。

您也可以查看this bug

答案 1 :(得分:1)

如果您仍然坚持使用Ant,我建议您至少考虑将Ivy添加到图片中,作为您的依赖管理器。如果我没记错的话,它能够更新存储库中的maven-metadata.xml文件。

查看http://bootsnipp.com/snippets/featured/responsive-moving-box-carousel示例。