java Gradle无效的发布“shadow”:具有相同扩展名和分类符(“jar”、“all”)的多个工件

vlju58qv  于 2023-02-28  发布在  Java
关注(0)|答案(1)|浏览(197)

今天我发现发布的工件没有包含我的着色库。我想把它们放在里面,所以我决定在我的build.gradle中编辑我的发布部分

publishing {
    repositories {
        maven {
            name = "GitHubPackages"
            url = "https://maven.pkg.github.com/oraxen/Oraxen"
            credentials {
                username = System.getenv("GITHUB_ACTOR")
                password = System.getenv("GITHUB_TOKEN")
            }
        }
    }
    publications {
        shadow(MavenPublication) {
            from components.java
            artifact shadowJar
        }
    }
}
// entire file: https://github.com/oraxen/oraxen/blob/06ca465c8854c9e3df386a608845d86852e70560/build.gradle

不幸的是,我得到了这个错误:

Execution failed for task ':publishShadowPublicationToGitHubPackagesRepository'.
> Failed to publish publication 'shadow' to repository 'GitHubPackages'
   > Invalid publication 'shadow': multiple artifacts with the identical extension and classifier ('jar', 'all').

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

如何指定要上载-all工件?

ajsxfq5m

ajsxfq5m1#

components.java应该包含shadow jar和原始jar,因此只需删除artifact shadowJar行即可。

相关问题