Where do resource files go in a Gradle project that builds a Java 9 module?

Update (25 March 2020): There has been significant progress towards proper JPMS support. A nightly build of Gradle 6.4 now includes options to develop with Java 9 modules natively. See https://github.com/gradle/gradle/issues/890#issuecomment-603289940 . Update (29 September 2020): Since Gradle 6.4 (current release as of this update is 6.6.1) you can now support JPMS modules natively in … Read more

java 9 module reads package X from A and B

Excluding the transitive dependency made it work and adjusting the module-info.java too!!! compile(“org.springframework.boot:spring-boot-starter:1.5.3.RELEASE”) { exclude group: ‘commons-logging’, module: ‘commons-logging’ } compile(“org.springframework.boot:spring-boot-starter-web:1.5.3.RELEASE”){ exclude group: ‘commons-logging’, module: ‘commons-logging’ }

Self-Contained Applications, built in Java

jlink Yes, this is possible with jlink (JEP 282), but all of your code and your dependencies need to be modular JARs (i.e. ones with module-info.class). It works like this: jlink –module-path $JAVA_HOME/jmods:mods –add-modules your.app –launcher launch-app=your.app –output your-app-image In detail: –module-path lists the folders that contain modules – this needs to include the platform … Read more

What’s the difference between requires and requires static in module declaration

A requires clause expresses that the required module is needed at compile and run time. Consequently, when the module system encounters such a clause during module resolution (the phase in which module descriptors are processed and dependencies are resolved) it searches the universe of observable modules (the modules in the JDK and on the module … Read more

In Eclipse, what is the difference between modulepath and classpath?

The module system has mainly the following impact on the code: A package can only be accessed from one module (Nested packages are treated as separate, so even though the package java.util is in the module java.base, the package java.util.logging can be in the module java.logging) You can only access public fields and methods of … Read more

Classloaders hierarchy in Java 9

Here is the migration guide for Java 9, New Class Loader Implementations JDK 9 maintains the hierarchy of class loaders that existed since the 1.2 release. However, the following changes have been made to implement the module system: The application class loader is no longer an instance of URLClassLoader but, rather, of an internal class. … Read more

Java 9 + maven + junit: does test code need module-info.java of its own and where to put it?

The module system does not distinguish between production code and test code, so if you choose to modularize test code, the prod.module and the test.module cannot share the same package com.acme.project, as described in the specs: Non-interference — The Java compiler, virtual machine, and run-time system must ensure that modules that contain packages of the … Read more