Gradle Maven出版物:“尽管执行了操作,但任务尚未声明任何输出”

时间:2018-07-31 13:46:49

标签: maven gradle

我想将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'
            }
        }
    }
}

1 个答案:

答案 0 :(得分:1)

根据https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven:install,看来mavenLocal()中不能有repositories声明