I installed Version: Oxygen.1a Release (4.7.1a) Build id: 20171005-1200 supporting Java 9.
With suggested configuratio on eclipse.ini
-vm
C:\Program Files\Java\jdk-9\bin\javaw.exe
--add-modules=ALL-SYSTEM
I have developed by java 9 (java 9 modularity) code project to test dependency injection as pure Java prject from eclipse, but when I have integrated Maven running my from eclipse I get systematically the following error
Error occurred during initialization of boot layerjava.lang.module.FindException: Module com.my.module.hello.test not found
the only solution was to add on VM arguments
--module-path target/classes;../my-module-api/target/classes;../my-module-it/target/classes --module com.my.module.hello.test/com.my.module.hello.Reflection
Indeed if add to Vm arguments the verbose parameter I can see during loading
... [0.694s][info][class,load] java.lang.NamedPackage source: jrt:/java.base [0.697s][info][class,load] com.my.module.hello.MyHello source: file:/C:/Users/212442540/workspace-training/my-module-prj/my-module/target/classes/ [0.698s][info][class,load] java.lang.module.ModuleDescriptor$$Lambda$24/2114889273 source: java.lang.module.ModuleDescriptor ...
when I remove the "--module-path" parameter this line disappear.
Notice: Eclipse is able to work correctly during the compilation or editing. See the completition and so on ..
I have added modpath dependencies also to my project
I added the dependencies manually on the project config
So it seems that Eclipse is able to compile java 9 modules, but it is not able to run module if integrated with maven.
Forcing dependencies on Configratin Run I have also added the dependencies manually figure 1
but eclipse continues to remove them.
Before:
figure 2
After run eclipse restores:
It seems that eclipse reset systematically the configuration if integrated with maven.
I can reproduce your problem, it looks like a bug of M2Eclipse.
Please report it to Eclipse. Bug 526838 - Eclipse wrong Module dependencies on Run configuration when integrated with maven
As workaround use an External Tool Configuration instead of an Java application run configuration:
Enter the following values:
Location: C:\windows\system32\cmd.exe
Working Directory: ${workspace_loc:/my-module}
Arguments:
/C java
-p target/classes;../my-module-api/target/classes;../my-module-it/target/classes
-m com.my.module.hello.test/com.my.module.hello.Reflection
Click Run