Since Gradle 6.4, there is now built-in support for Java JPMS modules.
The configuration for application has changed a little, now using mainModule
and mainClass
. I previously used mainClassName
that contained the module and main class name.
plugins {
id 'java'
id 'application'
}
application {
mainModule = 'no.smeaworks'
mainClass = "no.smeaworks.movies.MoviesApplication"
}
java {
modularity.inferModulePath.set(true)
}
However it still complains that I should add mainClassName
, on both startScripts and run tasks of the application plugin.
>
Task :startScripts
No module was provided for main class, assuming the current module. Prefer providing ‘mainClassName’ in the following format: ‘$moduleName/a.b.Main’
>
Task :run
No module was provided for main class, assuming the current module. Prefer providing ‘mainClassName’ in the following format: ‘$moduleName/a.b.Main’
Even if I do add the mainClassName
, it still complains.
mainClassName = '$moduleName/no.smeaworks.movies.MoviesApplication'