【发布时间】:2013-11-19 11:27:55
【问题描述】:
我正在尝试构建 Apache S4 并将其发布到我们的 Nexus 存储库。 gradle publishToMavenLocal 工作,所以我添加了
publishing {
repositories {
maven {
credentials {
username "admin"
password "admin123"
}
url "http://127.0.0.1:9081/nexus/content/repositories/releases/"
}
}
}
在apply plugin: 'maven-publish' 之后发送给build.gradle。这适用于同一台机器上的其他项目。但是,现在我得到了
aromanov@ws:~/etc/apache-s4-0.6.0$ gradle clean publish
Build file '/home/aromanov/etc/apache-s4-0.6.0/subprojects/s4-benchmarks/s4-benchmarks.gradle': line 42
The RepositoryHandler.mavenRepo() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the maven() method instead.
Runs Apache RAT. Exclusions are defined in .rat-excludes fileUNDEFINED
:clean
:s4-base:clean
:s4-benchmarks:clean
:s4-comm:clean
:s4-core:clean
:s4-tools:clean
:test-apps:clean
:test-apps:consumer-app:clean
:test-apps:producer-app:clean
:test-apps:simple-deployable-app-1:clean
:s4-base:publish UP-TO-DATE
:s4-benchmarks:publish UP-TO-DATE
:s4-comm:publish UP-TO-DATE
:s4-core:publish UP-TO-DATE
:s4-tools:publish UP-TO-DATE
:test-apps:publish UP-TO-DATE
:test-apps:consumer-app:publish UP-TO-DATE
:test-apps:producer-app:publish UP-TO-DATE
:test-apps:simple-deployable-app-1:publish UP-TO-DATE
BUILD SUCCESSFUL
Total time: 10.468 secs
使用gradle -i 我明白了
Selected primary task 'publish'
Tasks to be executed: [task ':s4-base:publish', task ':s4-benchmarks:publish', task ':s4-comm:publish', task ':s4-core:publish', task ':s4-tools:publish', task ':test-apps:publish', task ':test-apps:consumer-app:publish', task ':test-apps:producer-app:publish', task ':test-apps:simple-deployable-app-1:publish']
:s4-base:publish (Thread[main,5,main]) started.
:s4-base:publish
Skipping task ':s4-base:publish' as it has no actions.
:s4-base:publish UP-TO-DATE
:s4-base:publish (Thread[main,5,main]) completed. Took 0.005 secs.
... so on for other subprojects
Nexus 存储库中没有输出。我该如何解决这个问题?
更新:如果我使用用户指南第 51 章中的配置,请将 ivy 替换为 maven:
uploadArchives {
repositories {
maven {
credentials {
username "admin"
password "admin123"
}
url "http://127.0.0.1:9081/nexus/content/repositories/releases/"
}
}
}
然后上传工作,但它上传 jars 和 ivy.xml,没有 POM。使用第 52 章的配置:
configurations {
deployerJars
}
dependencies {
deployerJars "org.apache.maven.wagon:wagon-http:2.2"
}
uploadArchives {
configuration = configurations.deployerJars
repositories {
mavenDeployer {
repository(url: "http://127.0.0.1:9081/nexus/content/repositories/releases/") {
authentication(userName: "admin", password: "admin123")
}
}
}
}
我明白了
aromanov@ws:~/etc/apache-s4-0.6.0$ gradle -i upload
Starting Build
Starting file lock listener thread.
...
Publishing configuration: configuration ':s4-base:deployerJars'
Publishing to repository 'mavenDeployer'
[ant:null] Error reading settings file '/tmp/gradle_empty_settings2934509160228124339.xml' - ignoring. Error was: /tmp/gradle_empty_settings2934509160228124339.xml (No such file or directory)
:s4-base:uploadArchives (Thread[main,5,main]) completed. Took 1.113 secs.
...
【问题讨论】:
-
您是否按照Gradle User Guide 中的说明声明了任何出版物?另请注意,新的和孵化的
maven-publish插件有已知的限制。就目前而言,使用现有的maven插件通常更安全。 -
@PeterNiederwieser 我尝试使用
maven插件,但没有成功。查看更新。 -
如果它上传
ivy.xml,那么您的构建脚本可能有问题(但根据提供的信息我不能说是什么)。最后一个 sn-p 失败,因为必须在使用之前声明配置(即configurations必须在dependencies之前)。 -
是的。我已经修复了该部分以及
uploadArchives配置。仍然没有成功,但至少有一些进展。 -
更多提示: 1. 我不会同时应用
maven和maven-publish插件。 2.uploadArchives.configuration决定上传什么。相反,你想要的是uploadArchives.repositories.mavenDeployer.configuration = configurations.deployerJars。我们是不是在某个地方的文档中弄错了?
标签: gradle build.gradle