Hi,

On behalf of the Apache Maven team I'm working on the Plexus Compiler[1] to support compilation of modules and I'm struggling with the specification of the modulepath.

According to JEP 261[1] the path of -mp <path> is not the same as -cp <path>. Based of the commandline help of javac I assumed both paths were the same, since the parameter argument has the same name. After reading the specs it seems like I can only refer to a directory containing modules. For a dependency specified in the pom.xml I could refer to the directory (within the local repository) containing that specific artifact. However, such directory contains more files, so I can't be certain the correct file is picked up (e.g. cooomons-lang3-3.4[2]. Both commons-lang3-3.4.jar and commons-lang3-3.4-tests.jar might contain a module-info.class, but it is uncertain if this was the file specified as dependency). So it seems like for every Maven Project I need to copy the dependencies to a specific folder and use this as argument for -mp. My problem with this is: a. IO is considered slow, so making these copies are expensive. In case of a multimodule Maven project this will have a huge negative impact. Based on several mailingthreads it seems to me that speed is the most important requirement for a build tool. b. You will get dozens of copies of the same jar all over your system. This reminds me of the times where you added a lib-directory to your java project and committed all these files into your SCM...

The beauty of the classpath is that you can *refer* to a specific *jar*. It is precise and has no overhead.

Executing javac is probably fast, but the preparations the maven-compiler-plugin must do to be able to call javac will take much more time.

To ensure that exactly the dependencies as specified in the pom.xml are used (not more or less) without the need to copy files it would be my wish to have -mp also support (jar)-files.

thanks,
Robert Scholte

[1] https://github.com/codehaus-plexus/plexus-compiler/tree/jigsaw-ea
[2] https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.4/

Reply via email to