Compile Jigsaw multi module


Compile Jigsaw multi module



I'm tried to get Jigsaw working using a multi module project, but without any luck.


src
+----com.example.foo
| |
| |--- Foo.java
|
+----com.example.bar
| |
| |--- Bar.java
|
+----readymodules
|
+ Foo
| |
| |--- nodule-info.java
|
+ Bar
|
|--- module-info.java



Content of src/readymodules/Foo/nodule-info.java


module readymodules.Foo {
exports com.example.foo;
}



Xontent of src/readymodules/Bar/nodule-info.java


module readymodules.Bar {
exports com.example.Bar;
requires readymodules.Foo;
}



Now I want to compile using (I'm in parent of src)


$ javac -d mods --module-source-path src $(find src -name "*.java")
src/com/example/foo/Foo.java :1: error: not in a module on the module source path
package com.example.foo;
src/com/example/bar/Bar.java :1: error: not in a module on the module source path
package com.example.bar;
src/readymodules/Bar/module-info.java:1: error: module not found on module source path
module readymodules.Bar
package com.example.foo;
src/readymodules/Foo/module-info.java:1: error: module not found on module source path
module readymodules.Foo



What do I wrong?





Hopefully, the jigsaw quick start can help you understand the hierarchy/structure to be followed.
– nullpointer
Jul 3 at 3:52






I see a couple of typos saying "nodule-info" instead of "module-info". Is that just here in the question or do you have that typo as well in your source code?
– pupeno
Jul 7 at 9:39





Why are you putting the module-info.java in a separate directory instead of at the root of each actual module (com/example/foo and com/example/bar)?
– pupeno
Jul 7 at 9:42


module-info.java









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.