How do I configure Spring Boot Gradle plugin 2 to disable the Boot distribution in Gradle Script Kotlin.
The distribution i want is a assembly bundle zip with all dependencies (and the jar) in the lib folder.
I have enabled the Jar task and disabled the bootJar task.
Current source of my build file https://github.com/Skatteetaten/mokey/blob/825a81f20c21a2220876a09ebf7f01fe7c61f2fd/build.gradle.kts
Note that the aurora skatteetaten gradle plugin adds the distribution mechanism. https://github.com/Skatteetaten/aurora-gradle-plugin
This kotlin DSL version of @panser answer works for me (disable spring-boot bootJar task and enable jar task):
When the application plugin is configured, Spring Boot creates an additional distribution that contains the application packages as a fat jar. The default distribution is left intact and you should be able to use it without disabling Boot's distribution.
The default distribution relies on the standard
jar
task. This task is disabled by Spring Boot's plugin by default as the assumption is that you will want to use the fat jar produced bybootJar
instead. When that's not the case, you can re-enable the jar like this:With this change in place, you can run the
distZip
task:It will create a zip that packages the application and all of its dependencies as separate jars in the
lib
directory of the distribution.spring boot 2.x
My project is multi-module, each module can execute jar
root build.gradle
Sub-module build.gradle
Then you can click the bootRun submodule in the 'Tasks/application or build' of the idea gradle plugin, or click bootJar to generate the jar.
In spring-boot 2, the gradle plugin reconfigures the build to include the boot tar and zip distributions in the uploadArchives task when you apply the application and maven plugins.
From what I can tell from your question, you want a single zip-file with all the jar files in it, similar to what the application plugin creates, but want to exclude everything "extra" that the spring boot plugin adds? If that is the case it is a simple matter of telling gradle to do exactly that;
This is groovy, but hopefully you are able to apply this in a similar way in your kotlin file.
this work for me (disable spring-boot bootJar task, and enable jar)