Current version (with problems) springboot version 2.5.0 gradle version 7.0.2
In the custom gradle plugin, jar.archiveFileName.get() cannot get the expected name of the running jar, but xxx-plain.jar is returned, but xxx.jar is actually wanted
If you have not upgraded, you can get xxx.jar, the previous version springboot version 2.3.4, gradle version 6.8
Now if I want to get xxx.jar as before, I have to add the following configuration in the build.gradle.kts file, but I think this configuration is unnecessary. When we get the name of the executed jar, do we need to bring plain, the key xxx. plain.jar is not a complete execution jar at all
tasks.getByName<Jar>("jar") {
enabled = false
archiveFileName.set(rootProject.name + "-" + project.version.toString() + ".jar")
}
I hope someone who understands the reason can give an answer, thank you!
Comment From: snicoll
This is covered in the release notes with a link to the reference documentation that provides samples on how to disable the jar
task so that it does not generate the -plain
version.
If you have a questions regarding a Grade plugin you wrote, the Gradle support is a better place for that.
Comment From: ft0907
Even if I configure to disable not building normal archives according to the document prompts, Of course, in the gradle custom plugin, the string of xxx-plain.jar obtained through Jar.archiveFileName.get() or obtained, I changed how to get Jar.archiveFileName.get() to obtain xxx-plain.jar instead of through customization archiveFileName.set to manually configure, because this is too cumbersome.
Comment From: wilkinsona
I’m not sure exactly what you are trying to do, but you should probably use bootJar.archiveFileName.get()
instead.
Comment From: ft0907
But I cannot get the bootjar.archiveFileName.get() object method in the gradle plugin code, unless I configure it in the build.gradle file
This problem, I also mentioned this problem in the official gradle library, my requirement is actually very simple, without additional configuration, the correct jar (xxx.jar) can be obtained through jar.archiveFileName.get() The name is OK instead of (xxx-plain.jar)
I don’t know if my problem is described clearly enough, I can also provide a more complete execution code
Comment From: wilkinsona
xxx-plain.jar
is the correct name for the jar
task as Spring Boot configures it with a classifier of plain
.
Comment From: ft0907
But xxx-plain.jar is not an executable jar, what I need is a complete executable jar that contains all the new ones.
Comment From: wilkinsona
Then you need to query the bootJar
task as it is the task that produces the executable jar.
If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.