I have a Maven multi-module project.
Module 1generates a jar file which does not use Java 9 modulesModule 2has amodule-info.javafile and uses Module 1's Jar as an automatic module
When I compile Module 1 and then Module 2, everything is fine. When I build using the parent pom, Module 2 fails because it cannot find Module 1 as a Java 9 automatic module.
Looking at the output of the maven-compiler-plugin, I see this when I build the parent pom:
Classpath:
/path/to/myproject/module2/target/classes
/path/to/myproject/module1/target/classes
Modulepath:
/path/to/other/jarFile1.jar
/path/to/other/jarFile2.jar
Source roots:
/path/to/myproject/module2/src/main/java
Module 1 has been included on the classpath as a series of .class files, rather than on the Module path as a jar.
In the pom files I have:
- parent
pom.xml module1.pom-> generatesmyproject:module1:v1:jarmodule2.pom-> dependency onmyproject:module1:v1:jar, generatesmyproject:module2:v1:jar
How can I tell Maven to
- not include module1 on the classpath as a series of classes?
- include
module1.jarin the modulepath?
I have tried both 3.8.1 and 3.10.1 and have tried the elements recommended in this answer, but it doesn't help.