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

Gradle Invalid publication 'shadow': multiple artifacts with the identical extension and classifier ('jar', 'all')

提问人:Th0rgal 提问时间:8/5/2021 更新时间:2/27/2023 访问量:5706

问:

直到今天,我发现已发布的工件不包括我的着色库。我想把它们放在里面,所以我决定在我的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 工件?

Java Gradle Groovy

评论


答:

14赞 thekingofcity 10/27/2021 #1

components.java应该包含影子罐子和原来的罐子,所以只需删除线条就可以了。artifact shadowJar

评论

0赞 Evgeniy Mishustin 8/8/2023
但这会导致非混淆的来源