- Set working directory to
- Find out which is the bottom module -> use
jdeps build/libs/*.jar
onuser-service-consumer
- Find out which is the bottom module -> use
jdeps build/libs/*.jar
onuser-service-consumer
- Add
module-info.java
to java folder ofuser-domain
module - Set working directory to user-domain module and execute
jdeps -s build/libs/*.jar
to see the resulting dependencies
- Add
module-info.java
to java folder ofuser-service
module - Copy
user-domain.jar
to libs folder ofuser-service
module - Set working directory to user-service module and execute
jdeps -s build/libs/*.jar
to see the resulting dependencies
- Assume we do not yet know the
ch.resrc.consumers.user
package is defined in more than one module - Add
module-info.java
to java folder ofuser-service-provider-1
module - Set working directory to user-service-provider-1 module and execute
jdeps -s build/libs/*.jar
to see the resulting dependencies
- Add
module-info.java
to java folder ofuser-service-provider-2
module - Set working directory to user-service-provider-2 module and execute
jdeps -s build/libs/*.jar
to see the resulting dependencies
- Add
module-info.java
to java folder ofuser-service-consumer
module - Now the compile complains about reading package
ch.resrc.consumer.user
from bothuser-service-provider-1
anduser-service-provider-2
- Fix split package by removing
user-service-provider-2
and renaminguser-service-provider-1
touser-service-provider
- Execute
installDist
- Create dot files to visualize dependencies by executing:
jdeps -dotoutput build/graphs build/install/application/lib/*.jar
- Set working directory to user-service-consumer module and execute
jdeps -s build/libs/*.jar
to see the resulting dependencies
The follwoing commands assume the working directory to be module-examples/basic-example/application
java -p build/install/application/lib -m application/ch.resrc.application.Application
To create an executable for the application execute: jlink --module-path $JAVA_HOME/jmods:build/install/application/lib --add-modules application --launcher application=application/ch.resrc.application.Application --output build/application --compress=2
This command executes the executable created via jlink: build/install/application/bin/application
Display size of JDK: du -h $JAVA_HOME
Display size of executable: du -h build/application
To analyze the dependencies of the modules execute: jdeps build/install/application/lib/*.jar
To get a summary of the dependencies execute: jdeps -s build/install/application/lib/*.jar
jdeps -dotoutput build/graphs build/install/application/lib/*.jar
You need to install graphviz for this to work (brew install graphviz
)
To create a png file for the dependency summary execute: dot -Tpng -Gdpi=300 build/graphs/summary.dot > build/graphs/summary.png
For the application module execute: dot -Tpng -Gdpi=300 build/graphs/application.jar.dot > build/graphs/application.png
For the service module execute: dot -Tpng -Gdpi=300 build/graphs/services.jar.dot > build/graphs/services.png