java - Spring Boot Multi Module Gradle Build - Multiple "Fat Jars" -
our spring-boot project looks following
project |__ build.gradle |__ settings.gradle |__ module_a |__ module_b |__ ... |__ module_a |__ module_b
module_a contains springapplication class , file application.properties
running ./gradlew build works fine, problem is, every module (about 10) gradle generates fat jar including dependencies.
we want have 1 far jar (in module a)
buildscript { ext { springbootversion = '1.2.0.release' springloadedversion = '1.2.0.release' } repositories { // note: should declare repositories need here mavencentral() maven { url "http://repo.spring.io/release" } maven { url "http://repo.spring.io/milestone" } maven { url "http://repo.spring.io/snapshot" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springbootversion}") classpath("org.springframework:springloaded:${springloadedversion}") } } allprojects { group = "example.group" version = "0.0.1" repositories() { mavencentral() } } subprojects { apply plugin: "groovy" apply plugin: "eclipse" eclipse { classpath { containers.remove("org.eclipse.jdt.launching.jre_container") containers "org.eclipse.jdt.launching.jre_container/org.eclipse.jdt.internal.debug.ui.launcher.standardvmtype/javase-1.8" } } apply plugin: "idea" apply plugin: "java" apply plugin: "spring-boot" mainclassname = "mainclassname" sourcecompatibility = 1.8 targetcompatibility = 1.8 dependencies { } } task wrapper(type: wrapper) { gradleversion = '2.2' }
we tried adding options jar.enabled = false bootrepackage.enabled = false
in subprojects section, after that, project wont comile longer.
rather applying spring boot plugin every sub-project, apply module_a
:
project(':module_a') { apply plugin: 'org.springframework.boot' }
Comments
Post a Comment