1
我的gradle構建副本文件。我想用複製任務的輸出作爲Maven構件輸入出版從副本任務發佈工件
例如:
task example(type: Copy) {
from "build.gradle" // use as example
into "build/distributions"
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact example
}
}
}
的Gradle,但不喜歡它:
* What went wrong:
A problem occurred configuring project ':myproject'.
> Exception thrown while executing model rule: PublishingPlugin.Rules#publishing(ExtensionContainer)
> Cannot convert the provided notation to an object of type MavenArtifact: task ':myproject:example'.
The following types/formats are supported:
- Instances of MavenArtifact.
- Instances of AbstractArchiveTask, for example jar.
- Instances of PublishArtifact
- Maps containing a 'source' entry, for example [source: '/path/to/file', extension: 'zip'].
- Anything that can be converted to a file, as per Project.file()
爲什麼?
據我所知,任務示例的輸出應該由Copy任務設置。我認爲它可以轉換爲一些文件。所以它應該用作發佈任務的輸入,作爲文件。但是錯誤信息告訴我我錯了。
我該如何解決?
感謝
我一直在尋找這個答案近一個星期。救世主:) – CoderSpinoza