问题
I want to create hello world java 9 application and start it in intellij idea.
Now I have following structure:
content of inner module-info.java:
module my.module.Second {
requires my.module.First;
}
content of outer module-info.java:
module my.module.First {
exports my.pack;
}
But idea complains about my project:
Error:(1, 1) java: too many module declarations found
I don't understand why it happens and what really wrong. So
Question:
My question is how to force idea to accept my hello world.
P.S. From the first glance error looks obvious but I have project which I downloaded from github with the same structure but it works properly and idea doesn't complain about it:
回答1:
According to Oracle Jar file specification
A modular JAR file is a JAR file that has a module descriptor, module-info.class, in the top-level directory (or root) directory.
One Jar could contain only one module.
To fix you problem you have to split your project (create several maven modules)
来源:https://stackoverflow.com/questions/56293275/idea-too-many-module-declarations-found