On Sat, 24 Nov 2018 13:28:28 +0100, Martin Desruisseaux <martin.desruisse...@geomatys.com> wrote:

Hello Robert

Thanks for your reply.

Le 24/11/2018 à 12:36, Robert Scholte a écrit :

Let me correct this part: there is *no* need to change the folder
structure to work with the Java Platform Modular System. The only
thing you need to do is add a module-info.java to src/main/java and
ensure you're using maven-compiler-plugin-3.8.0. That's it!

My email was saying that there is a need to change the folder structure
for using Java Platform Modular System with "--module-path" options. The
key part is "--module-path". What maven-compiler-plugin-3.8.0 does is to
use the "--class-path" options, which are the legacy options before Jigsaw.

The consequence is that it is currently not possible to build more than
one Jigsaw module in a single invocation of "javac", "javadoc", "jlink"
or other JDK tools with Maven. Consequently I'm not aware of any way to
generate a multi-modules javadoc, or to execute annotation processors
using information from more than one module (except by generating
temporary files), or any other task for which there is advantages in
being able to use standard JDK tools with their new "--module-path" options.

With the Java Platform Modular System you'll clearly see different requirements between library and application developers. Keep in mind that 1 pom-file can represent only 1 module. If you want to distribute multiple modules, you will still need a multimodule Maven project. Single invocation only makes sense for an application that won't share modules. Up until know there's only 1 such large application: the JDK itself (it is not really sharing modules, modules are part of the application) So yes: single invocation is an option for the jdk tools but doesn't fit in the Maven architecture and is probably in general not that needed. There are no plans to make these changes in Maven. As response Remi Forax wrote Pro[1], which is build upon these new jdk tools features combined with the concepts of Maven.

[1] https://github.com/forax/pro


What I want is to be able to use Maven with Java "--module-path" options
instead than "--class-path". This is where the Maven standard directory
layout become an obstacle, because the "--module-path" option imposes a
directory layout which is different than the Maven's one.

No, module-path is not the issue, but module-source-path is, which expects an extra folder reflection the module-name.


I realize that not everyone may want to build a multi-modular project
using "--module-path" option. But before Java 9, Maven made the use of
javac easier without blocking the use of other options when desired.
Since Java 9, we have a difficulty for which I have not yet found a
satisfying solution other than the proposed Maven changes.

I don't understand this issue. As a java developer wanting to add module descriptor, you only have to create src/main/java/module-info.java. You can build your project as you are used to.



The key library which might(/should!) be interesting for you is
Plexus-Java [1], which calculates the modulepath.

I have not looked in details to Plexus-Java. Does it create a path for
each Maven module? That would be a workaround, but it still more
complicated than using Jigsaw in its "natural" way.

    Martin



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to