I would like to change the name of the jar when I do a
./gradlew clean assemble
The name of my jar is my-awsome-app-0.0.1-SNAPSHOT.jar
and I want to generate my-awsome-app.jar
.
I tested to do this in the build.gradle
:
configurations {
jar.archiveName = "my-awsome-app.${jar.extension}"
}
...but this is not working, the name is still the same
By default, Gradle uses the directory name as project name. You can change this by creating a settings. gradle file in the directory which specifies the project name. You can also add a description to your project via the build.
The build script defines a project and its tasks. To try this out, create the following build script named build. gradle . You run a Gradle build using the gradle command. The gradle command looks for a file called build.
Since you are using Spring Boot, you should use the bootJar
task instead (notice bootJar
extends Jar
).
Since archiveName
in Jar
has been deprecated, use archiveFileName
:
bootJar {
archiveFileName = 'my-awesome-app.jar'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With