指定组属性时Gradle uploadArtifacts失败

时间:2013-04-15 16:55:38

标签: java continuous-integration gradle nexus

我正在尝试使用gradle uploadArtifacts上传到我的nexus服务器,当我的build.gradle是:

apply plugin: 'java'
version = "1.0"
uploadArchives {
    repositories { ivy { url "http://<server>/nexus/content/repositories/snapshots" } }
}

但是,如果我指定要上传的群组,例如如果我将build.gradle更改为:

apply plugin: 'java'
group = "test"      // <-- addition of group property
version = "1.0"
uploadArchives {
    repositories { ivy { url "http://<server>/nexus/content/repositories/snapshots" } }
}

它没说:

Execution failed for task ':uploadArchives'.
> Could not publish configuration 'archives'
   > java.io.IOException: Could not PUT 'http://<server>/nexus/content/repositories/snapshots/test/test-project/1.0/test-project-1.0.jar'. Received status code 400 from server: Bad Request

如果我使用--debug运行,我得到的例外是:

Caused by: java.io.IOException: Could not PUT 'http://<server>/nexus/content/repositories/snapshots/test/test-project/1.0/test-project-1.0.jar'. Received status code 400 from server: Bad Request

我认为在服务器上创建目录可能会有问题,因为这是一个新工件,但即使我手动创建test / test-project / 1.0,上传仍然失败。 (如果没有组ID,它不会失败,但这会让我相信它不是一个关联问题。)

我的设置是:

Gradle 1.5 Gradle构建时间:2013年3月27日星期三下午1:51:06 UTC Groovy:1.8.6 Ant:2012年5月22日编译的Apache Ant(TM)版本1.8.4 常春藤:2.2.0 JVM:1.6.0_43(Apple Inc. 20.14-b01-447) 操作系统:Mac OS X 10.7.5 x86_64

Sonatype Nexus™2.3.0-04

有没有人见过这个或者知道我可能做错了什么?

谢谢。

1 个答案:

答案 0 :(得分:3)

我根本不知道gradle,但似乎您正在尝试将非快照工件发布到快照存储库:

version = "1.0"
url "http://<server>/nexus/content/repositories/*snapshots*"

您还可以在最终到达网址中看到: http://<server>/nexus/content/repositories/snapshots/test/test-project/1.0/test-project-1.0.jar