我正在将Java项目从gradle 2.x迁移到5.3.1。
最后一个问题是没有人工制品(在我们的案例中为tar)发布到人工制品上。
主build.gradle
中的配置为
subprojects {
apply plugin: "com.jfrog.artifactory"
project.ext {
artifactoryConfig = new File(project.gradle.gradleUserHomeDir, "artifactory.gradle")
}
if (artifactoryConfig.exists()) {
apply plugin: 'maven'
apply from: artifactoryConfig
}
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven { url $OUR_ARTIFACTORY }
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
}
artifactory {
publish {
contextUrl = "${artifactoryBaseUrl}"
repository {
repoKey = "libs-release-local"
username = "${artifactoryUsername}"
password = "${artifactoryPassword}"
}
}
resolve {
repoKey = 'repos'
}
}
在模块中
task('dist', type: Tar) {
dependsOn('jar')
archiveName "$MODULE-${version}.${extension}"
...
}
publishing {
publications {
mavenJava(MavenPublication)
{
artifact dist {
}
}
}
}
configurations.archives.artifacts.clear()
artifacts {
archives dist
}
现在,当我执行./gradlew --info :$MODULE:artifactoryPublish
时,它会抱怨缺少输出,并且不会将tar发布到工件上。
该如何解决?
> Task :$MODULE:artifactoryPublish
Task ':$MODULE:artifactoryPublish' is not up-to-date because:
Task has not declared any outputs despite executing actions.
:$MODULE:artifactoryPublish (Thread[Execution worker for ':',5,main]) completed. Took 0.002 secs.
:artifactoryDeploy (Thread[Execution worker for ':',5,main]) started.
> Task :artifactoryDeploy
Task ':artifactoryDeploy' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Deploying build descriptor to: $OUR_ARTIFACTORY/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under $OUR_ARTIFACTORY/artifactory/webapp/builds/$MODULE/1554465369336
:artifactoryDeploy (Thread[Execution worker for ':',5,main]) completed. Took 0.155 secs.
答案 0 :(得分:1)
对我来说,问题是网址和凭据为空。结果为相同的错误消息(任务未声明任何输出)。
artifactory {
contextUrl = artifactoryUrl
publish {
repository {
username = artifactoryPublishUser
password = artifactoryPublishPassword
答案 1 :(得分:1)
最有价值的提示是运行示例
https://github.com/jfrog/project-examples/tree/master/gradle-examples/gradle-android-example
答案 2 :(得分:0)
原来的解决方案是添加
artifactoryPublish {
publications('mavenJava')
}