Gradle-更改罐子的名称 [英] Gradle - Change the name of the jar
本文介绍了Gradle-更改罐子的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在做
./gradlew clean assemble
我的罐子的名字是my-awsome-app-0.0.1-SNAPSHOT.jar
,我想生成my-awsome-app.jar
.
The name of my jar is my-awsome-app-0.0.1-SNAPSHOT.jar
and I want to generate my-awsome-app.jar
.
我在build.gradle
中进行了测试:
configurations {
jar.archiveName = "my-awsome-app.${jar.extension}"
}
...但是这不起作用,名称仍然相同
...but this is not working, the name is still the same
推荐答案
由于您使用的是 Spring Boot ,因此应改用bootJar
任务(注意
Since you are using Spring Boot, you should use the bootJar
task instead (notice bootJar
extends Jar
).
由于Jar 中的rel ="noreferrer"> archiveName
已被弃用,请使用
Since archiveName
in Jar
has been deprecated, use archiveFileName
:
bootJar {
archiveFileName = 'my-awesome-app.jar'
}
这篇关于Gradle-更改罐子的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文