Spring Boot Gradle Plugin — multi module build — bootJar(false)

Jinhan Choi
1 min readDec 19, 2020

--

when setting as multi module spring boot projects
and using gradle spring plugin for build application.
you can meet same situation as me.

what i met is

Unresolved reference: core(module package name)

it means main application did’t recognize other module’s package when try to build and run.

as a result, it can be solved with gradle task option change.

kotlin dsl versiontasks.getByName<org.springframework.boot.gradle.tasks.bundling.BootJar>("bootJar") {
enabled = false
}
tasks.getByName<Jar>("jar") {
enabled = true
}
groovy dsl versionbootJar {
enabled = false
}
jar {
enabled = true
}

what u have to do is add jar { enabled = true } to module that didn’t recognized by main module.

and can also add bootJar enabled = false

bootJar task help us when build spring boot project as executable jar
and this is automatically applied when use java plugin

and this when this task applied. it change jar task enabled to false.

and it can caused problem that i met.

--

--

No responses yet