# Module dependences inside a Java multi-module build

**URL:** <https://discuss.gradle.org/t/module-dependences-inside-a-java-multi-module-build/37441>\
**Category:** Help/Discuss\
**Created:** [August 29, 2020, 6:23pm UTC](https://discuss.gradle.org/t/module-dependences-inside-a-java-multi-module-build/37441 "2020-08-29T18:23:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![doppelfish](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/doppelfish/32/8768_2.png) [@doppelfish](https://discuss.gradle.org/u/doppelfish)\
**Post date:** [August 29, 2020, 6:23pm UTC](https://discuss.gradle.org/t/module-dependences-inside-a-java-multi-module-build/37441/1 "2020-08-29T18:23:40Z")

</div>

Hi,

I’m using the Oracle JDK 14 and Gradle 6.6. I have a java project consisting of the following three java modules that I want to build with gradle:

```
./db/src/main/java/mileage.db/module-info.java
./db/src/main/java/mileage.db/mileage/db/Db.java
./gui/src/main/java/mileage.gui/module-info.java
./gui/src/main/java/mileage.gui/mileage/gui/Gui.java
./app/src/main/java/mileage.app/module-info.java
./app/src/main/java/mileage.app/mileage/app/App.java

```

Both the mileage.db and the mileage.gui module export their (currently only) package to mileage.app, hence the module-info.java file reads:

```
module mileage.db {
        exports mileage.db to mileage.app;
}

```

The GUI package has a similar module-info.java file.

I can build the project by hand, using the follwing commands:

```
javac -d build/classes/ --module-source-path app/src/main/java/:db/src/main/java:gui/src/main/java db/src/main/java/mileage.db/module-info.java db/src/main/java/mileage.db/mileage/db/Db.java
javac -d build/classes/ --module-source-path app/src/main/java/:db/src/main/java:gui/src/main/java gui/src/main/java/mileage.gui/module-info.java gui/src/main/java/mileage.gui/mileage/gui/Gui.java
javac -d build/classes/ --module-source-path app/src/main/java/:db/src/main/java:gui/src/main/java app/src/main/java/mileage.app/module-info.java app/src/main/java/mileage.app/mileage/app/App.java

```

But I can’t seem to write working gradle build files for this project. After much searching and trying, I can compile the source code into class files, but I keep getting the warning:

```
> Task :db:compileJava
/home/doppelfish/workspace/Mileage/db/src/main/java/mileage.db/module-info.java:2: warning: [module] module not found: mileage.app
        exports mileage.db to mileage.app;
                                     ^
1 warning

```

and a similar warning for the GUI package.

I suspect that I need to tell gradle to give the java compiler the “–module-source-path” option followed by al three source paths when it compiles the source of one module. Is that the issue? And if so, how could I resolve it?

Also, comments on the directory structure would be welcome.

cheers,  
doppelfish
