Java modules (JPMS) : Compile all modules at once

I started to get interested in gradle while working with java modules (JPMS). To test several things I used the example provided by gradle (Kotlin version).

https://docs.gradle.org/current/samples/sample_java_modules_multi_project.html

On this project we have several modules and during the gradle build, each java module is compiled independently by gradle to create the final application. (Gradle compiles first “list” then “utilities” then “application”).

One question I have is if it would be possible for gradle to compile all modules at once (one task). As it is explained here: Project Jigsaw: Quick Start Guide (Multi-module compilation part) it is possible to compile several java modules with one javac compilation command. Can gradle do something similar?

Hello @KontainPluton

i am new to gradle also

i think so but i did not tried the following yet

if you used the java plugin there compile task you can configure it

here the full details of this task JavaCompile - Gradle DSL Version 7.5

it has property called options

that has a property called compilerArgs which is a list of string you add the compiler argument there

not sure if there much easier way for that or not

hope that help and have a nice day :slight_smile:

1 Like