我想将zip存档发布到远程Maven存储库。任务zipSources
将示例文件打包到zip存档中。出版物myPubliction
发布到mavenLocal
和远程Maven存储库。
该出版物有效-我可以看到已将软件包上传到远程存储库。但是构建仍然会失败
> Task :publishMyPublicationPublicationToMavenRepository FAILED
Task ':publishMyPublicationPublicationToMavenRepository' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Publishing to repository 'maven' (null)
FAILURE: Build failed with an exception.
我想念什么?如何声明发布操作的输出?还是还有其他原因?
这是我的build.gradle
:
plugins {
id "maven-publish"
}
group = 'com.example.test'
version = '0.0.1-SNAPSHOT'
task zipSources(type: Zip, group: "Archive", description: "Archives source in a zip file") {
from ("src") {
include "myfile.txt"
}
into "dest"
baseName = "helloworld-demo"
destinationDir = file("zips")
}
publishing {
publications {
myPublication(MavenPublication) {
artifactId = 'my-library'
artifact zipSources
pom {
name = 'My Library'
description = 'A concise description of my library'
}
}
}
repositories {
maven {
mavenLocal()
}
maven {
url "http://nexus.local/content/repositories/snapshots"
credentials {
username = 'admin'
password = 'admin'
}
}
}
}
答案 0 :(得分:1)
根据https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven:install,看来mavenLocal()
中不能有repositories
声明