mavenjava-modulejava-platform-module-systemmaven-compiler-pluginmodule-path

Does maven add all dependencies to modulepath by default?


I read on Java 9 Modularity book:

Dependencies are always put on the module path, even when dependency isn't modularized yet.

[...] The most important changes made to Apache Maven for support of the Java module system are as follows:

  • Uses the modulepath during compilation
  • Supports a mix of explicit modules and automatic modules as dependencies

I'm looking at maven documentation and I cannot find this information anywhere.

Does maven by default add <dependencies> to the modulepath (only?) and if yes, after which maven version?

Also if the above is true is there a way to instruct maven to not use modulepath at all?


Solution

  • No, Maven puts dependencies to module path only for those Maven modules that have module descriptors (module-info.java). Non-modular Maven modules still put their dependencies to classpath.

    You can run Maven with -X option to see exact command-line options that are passed to javac.