[英]How to rename jar file that's being published using Gradle with maven-publish and shadow plugins?
Basically what I'm trying to do is publish a jar file to GitHub Packages with a certain name.基本上我要做的是将 jar 文件发布到具有特定名称的 GitHub 包。 What I have now is:
我现在拥有的是:
shadowJar {
archiveFileName = "Some-Name-${parent.version}.${extension}"
}
publishing {
...
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
artifactId = 'me.project'
groupId = 'some-project'
version = 1.1.0
}
}
}
But from this I get some-project-1.1.0-all.jar
, I would like to get some-project-1.1.0.jar
but cant seem to find the way how.但是从这里我得到
some-project-1.1.0-all.jar
,我想得到some-project-1.1.0.jar
但似乎找不到方法。 Changing the archiveFileName
in the shadowJar
task doesn't seem to affect the publishing
jar only the build
jar.更改
archiveFileName
任务中的shadowJar
似乎不会影响publishing
jar 仅影响build
jar。
I believe you need to change the archiveClassifier
of the shadowJar
task.我相信您需要更改
archiveClassifier
任务的shadowJar
。 By default, this is configured as all
.默认情况下,这被配置为
all
。
Something like:就像是:
tasks.shadowJar {
archiveClassifier = ""
}
The shadowJar
task extends of the Jar
task type. shadowJar
任务扩展了Jar
任务类型。 By default, with the Java plugin , archiveClassifier
is configured as an empty String ""
.默认情况下,使用Java 插件,
archiveClassifier
配置为空字符串""
。 The Shadow plugin reconfigures its shadowJar
task with all
. Shadow 插件使用
all
重新配置其shadowJar
任务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.