Hello Robert Thanks for your reply
Le 24/04/2018 à 19:44, Robert Scholte a écrit : > On Tue, 24 Apr 2018 13:00:27 +0200, Martin Desruisseaux > <[email protected]> wrote: > >> * We now have two conflicting conventions: Maven and Java 9. (…snip…) >> > I don't think they are conflicting. Java has no defaults for the > directories. What you see at conferences is that the people from > Oracle choose not to work with a buildtool like most developers do > (…snip…) > This convention seems to be bundled in javac and javadoc tools when the --module-source-path option is used. Given the following directories: src/ ├─ foo.bar/ │ ├─ module-info.java │ └─ foo/ │ └─ bar/ │ └─ Stuff.java out/ Attempt to run "javac --module-source-path src -d out" produces the following error message if the module name declared in module-info.java does not match the directory name: error: module name foo.baz does not match expected name foo.bar I have not yet been able to get javac or javadoc to work with --module-path and --module-source-path options if not following strictly the above directory structure convention. It may be because I did not yet found the right options combination, but at least it appears that not following that convention makes the use of those options more difficult. > The reason to add the module-name as an extra directory in front of > the sourcefolder is only interesting when compiling multiple modules > at once, so you can separate these modules from each other. This model > doesn't fit well, because every module is represented by a jar, every > jar need to have a groupId + artifactId + version. Saying it the other > way around: with a pom.xml you can only generate one module. Hence > there's no need for the extra module name. Maven just works with > src/main/java/module-info.java > I do not question that there is exactly one pom.xml file per module. My issue is merely about whether the "src/main/java" components of the path should be before or after the module directory, and the name of that module directory. Processing multiple modules at once is interesting for generating multi-modules javadoc. Even with javac and even if the end result is one JAR file per module, compiling multiple modules at once is still interesting if we want to run an annotation processor on all the project at once. Prior to Java 9, Maven made developer work much easier thanks to dependency management and other great services, without making the use of standard tools (javac and friends) more difficult. Trying to use javac without Maven was still tedious because we had to manage the -classpath option, but it was not Maven fault. But with Java 9, we are now in a situation were using Maven makes some uses of standard tools more difficult, unless we accept a departure from Maven conventions. > As said before, every module needs its own pom.xml. It would require a > complete new architecture of Maven to make this possible, where a > single Maven project can create multiple jars, all with their own > unique pom. It is very unlikely that this will be implemented, unless > the community really wants it and there's enough benefit to do so. > Understood, but this email is not about breaking the "1 pom == 1 module" relationship. It is about a re-organisation of directories order in Maven conventions. I could probably do the same by setting explicitly the source directory in every Maven plugins. But doing so would break Maven users expectations. Conversely, not doing so may break Jigsaw users expectations. So my question is about whether some peoples have tried this approach, and whether is would be worth to consider a second Maven convention in parallel to the existing one. Martin
