Slackbot
12/08/2023, 3:51 PMVampire
12/08/2023, 4:08 PMMain-Class attribute like that, especially as Spring Boot builds a good-practice fat jar that needs to be launched through its bootstrap class iirc. So if you remove that configuration and just take the result of the bootJar task, I think it should run properly.amol aggarwal
12/08/2023, 4:17 PMVampire
12/08/2023, 4:22 PMbootJar, not jar?Vampire
12/08/2023, 4:22 PMamol aggarwal
12/08/2023, 4:30 PMamol aggarwal
12/08/2023, 4:31 PMamol aggarwal
12/08/2023, 4:31 PMVampire
12/08/2023, 4:32 PMVampire
12/08/2023, 4:38 PMjar only containing your code.amol aggarwal
12/08/2023, 4:38 PMamol aggarwal
12/08/2023, 4:39 PMVampire
12/08/2023, 4:41 PMjar task even is disabled with the spring boot plugin applied, so if you actually can execute the jar task you manually enabled it. But as I said, use the bootJar task to produce the right jar.amol aggarwal
12/08/2023, 4:42 PMamol aggarwal
12/08/2023, 4:42 PMVampire
12/08/2023, 4:43 PMBOOT-INF directory that contains all your dependencies in a lib directory, all your code and resources in a classes directory, and besides the BOOT-INF folder org/springframework/boot/loader/... classes.Vampire
12/08/2023, 4:43 PMthis way?what "this way?"? That is setting the classifier for the boot jar, yes.
Vampire
12/08/2023, 4:43 PMamol aggarwal
12/08/2023, 4:45 PMVampire
12/08/2023, 4:45 PMamol aggarwal
12/08/2023, 4:45 PMVampire
12/08/2023, 4:45 PMamol aggarwal
12/08/2023, 4:46 PMtasks.withType<JavaCompile>() {
options.encoding = "UTF-8"
}
tasks.withType<Javadoc>() {
options.encoding = "UTF-8"
}
tasks.withType<Test> {
useJUnitPlatform()}Vampire
12/08/2023, 4:47 PMVampire
12/08/2023, 4:47 PM./gradlew <what do you do here?>amol aggarwal
12/08/2023, 4:47 PMVampire
12/08/2023, 4:48 PMbootJar is not wired to build.
So as I said, invoke the bootJar task.Vampire
12/08/2023, 4:49 PMclean task, that is a bad habit coming from Maven which was unreliable if you did not always run with clean.
If you need that in a Gradle build, you have a build bug somewhere.Vampire
12/08/2023, 4:49 PMamol aggarwal
12/08/2023, 4:51 PMVampire
12/08/2023, 4:54 PMassemble which is the task that also depends on jar and is depended upon by buildVampire
12/08/2023, 4:55 PMtasks.assemble {
dependsOn(tasks.bootJar)
}
then ./gradlew build will also build the boot jarVampire
12/08/2023, 4:56 PMassemble, not build, then you do not need to suppress test task.amol aggarwal
12/08/2023, 4:56 PMVampire
12/08/2023, 4:56 PMbuild depends on assemble and check while assemble depends on jar and check depends on test (and possibly other verification tasks)Vampire
12/08/2023, 4:57 PMamol aggarwal
12/08/2023, 4:57 PMamol aggarwal
12/08/2023, 4:57 PMamol aggarwal
12/08/2023, 5:10 PMVampire
12/08/2023, 5:20 PMis it bad practice to use application plugin with spring boot pluginI don't know. Maybe not as the Spring Boot Plugin has some support for when the
application plugin is applied.
The question is, whether it is necessary, whether you really want it and what it does.amol aggarwal
12/08/2023, 5:27 PMbootJar task. The task is automatically created when the java plugin is applied and is an instance of BootJar. The assemble task is automatically configured to depend upon the bootJar task so running assemble (or build) will also run the bootJar task.amol aggarwal
12/08/2023, 5:28 PMamol aggarwal
12/08/2023, 5:28 PMVampire
12/08/2023, 5:29 PMamol aggarwal
12/08/2023, 5:30 PMVampire
12/08/2023, 5:31 PMassemble is wired to bootJar but it isn't, you should probably open a bug report to Spring Boot.