I have multi-module Gradle project. Each module is full application with own @SpringBootApplication
. Root project has no sources in src. How to configure root/build.gradle to build all sub-modules to executable JARs on executing ./gradlew build
command from root directory?
Asked
Active
Viewed 474 times
1

Nikolay Toporkov
- 23
- 3
1 Answers
0
You could create a custom task in your root
module that will execute build
task for all submodules :
task buildAll() {
subprojects.forEach {
buildAll.dependsOn it.tasks.getByName('build')
}
}
and then invoke it :
./gradlew buildAll
This way every submodule will be build and boot jar will be available in the build/libs
directory of every submodule. Also you can name this task build
- it all depends on your current configuration.

Michał Krzywański
- 15,659
- 4
- 36
- 63