You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a maven project, a maven module creates two artifacts:
- a main artifact with a module-info.class file that defines a JPMS
module "foo.bar". The jar is called foo-bar-1.0.jar
- a test artifact which is not a JPMS module. It is called
foo-bar-1.0-tests.jar
Another module declares dependencies on both modules:
<dependencies>
<dependency>
<groupId>xxx</groupId>
<artifactId>foo-bar</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>xxx</groupId>
<artifactId>foo-bar</artifactId>
<version>1.0</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
This is a common use case in large projects. The LocationManager now
creates two JavaModuleDescriptors for the "foo.bar" JPMS module. One
from the main artifact and its module-info.class (automatic == false)
and one from the test artifact (automatic == true).
The current code considers these duplicates and drops one. As a result,
the test code no longer compiles because a dependency is missing.
The patch separates out modules with a module descriptor and automatic
modules.
Then it adds the modules with module descriptors to the module path.
Any duplicate is dropped for modules with module descriptors.
Finally, it adds the automatic modules; if a module with the same module
id already exists on the module path, it adds it to the class path.
In the case above, this will allow the compile to successfully compile
test code (the tests dependency drops to the class path, while the main
artifact is on the module path).
0 commit comments