英文:
How to publish a shadow jar with an empty pom using gradle maven-publish plugin and Kotlin DSL?
问题
以下是翻译好的内容:
来自https://imperceptiblethoughts.com/shadow/publishing的Groovy示例:
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
}
我对Kotlin版本的最佳尝试:
publishing {
publications {
create<MavenPublication>("pluginMaven") {
artifact(tasks["shadowJar"])
project.shadow.component(this)
}
}
}
在上述的Kotlin版本中,被影子化的依赖关系会显示在生成的POM中作为运行时依赖关系,这违背了影子化的目的。
英文:
The shadow plugin documentation has an example for groovy but I do not understand how to translate this to Kotlin.
Groovy example from https://imperceptiblethoughts.com/shadow/publishing :
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
}
My best attempt at the Kotlin version:
publishing {
publications {
create<MavenPublication>("pluginMaven") {
artifact(tasks["shadowJar"])
project.shadow.component(this)
}
}
}
With the above Kotlin version, shadowed dependencies show up in the resulting pom as runtime dependencies, which defies of purpose of shadowing.
答案1
得分: 1
以下是翻译好的部分:
解决方案是
tasks {
shadowJar {
archiveClassifier.set("")
minimize()
}
}
有关更多背景信息,请参阅[此 GitHub 问题](https://github.com/johnrengelman/shadow/issues/598)。
<details>
<summary>英文:</summary>
The solution is
tasks {
shadowJar {
archiveClassifier.set("")
minimize()
}
}
Some background in [this github issue](https://github.com/johnrengelman/shadow/issues/598).
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论