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

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

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

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