RFE support jar as modulepath argument
rfscholte at apache.org
Thu Dec 3 19:49:34 UTC 2015
On behalf of the Apache Maven team I'm working on the Plexus Compiler
to support compilation of modules and I'm struggling with the
specification of the modulepath.
According to JEP 261 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. 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
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
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.
More information about the jigsaw-dev