I have found that some libraries like google libphonenumber fail in a modular project with: error: module not found: libphonenumber.
Intellij is able to detect the module but not the :compileJava task
Even adding id(“org.gradlex.extra-java-module-info”) makes no difference. Any workaround ?
Just applying the extra module info plugin does nothing.
If that dependency is neither an explicit JPMS module, nor has an Automatic-Module-Name
in its manifest, Gradle will currently always put it to the classpath and never to the module path.
If you want to use the extra module info plugin to monkey-patch around the problem, you need to add configuration for that dependency as the documentation for that plugin shows you.
Thanks Björn
The point is if gradle already takes care of modules and it do it quite well… what actually happen with these kind of modules? shouldn’t it be a bug ??
“these kind of modules”?
A jar that neither has a module-info.class
nor an Automatic-Module-Name
manifest attribute is not a module.
It could still be thrown to the module-path and if it does not violate any of the constraints like unlucky jar naming, split packages, service loader usage, … it can maybe work as an automatic module with inferred module name.
But Gradle by default always puts those to the class path, unless you manually decide what goes to the classpath and what goes to the module path by manually configuring it in your build script, or by transforming non-modules to either full or automatic modules for example with the mentioned plugin.
hehehe … that’s why the kind hehehe.
Yes … the name is not very “standard”: requires libphonenumber;
And yes it does not have the module-info but as you mention Gradle automaticaly loads and I have done nothing manual… why is it not finding it?
I’ll try to investigate a little bit or move this project to maven
Thanks
Which part of
- does not have
module-info.class
- does not have
Automatic-Module-Name
attribute - does not get monkey-patched to have either (for example using the
extra-java-module-info
plugin and according configuration) - is not put to the module-path manually by the build script
=> it is put to the classpath by Gradle and thus not found as module
is unclear?