Hi Guys.
I’m starting to learn Java module and I created my first module with Gradle.
I noted that Gradle introduced building java modules directly.
Now I want some information about the use of java module with the last version Gradle.
My object supports the java module inside my library.
My module
build.gradle
plugins {
id 'java-library'
}
version = 0.1
ext.moduleName = "io.example.module"
repositories {
jcenter()
}
dependencies { }
jar {
inputs.property("moduleName", moduleName)
manifest {
attributes 'Automatic-Module-Name': moduleName
}
}
module-info.java
module io.vincenzopalazzo.lib {
exports io.vincenzopalazzo.module;
}
Now I import this local module (after the task jar) inside my client app, in the client app the build.gradle.ktn looks like
plugins {
java
application
}
repositories {
jcenter()
}
dependencies {
implementation(files("/home/vincent/Gitlab/test-java-jpms/module-example/build/libs/module-example-0.1.jar"))
}
application {
mainClassName = "io.vincenzopalazzo.client.App"
}
plugins.withType<JavaPlugin>().configureEach {
configure<JavaPluginExtension> {
modularity.inferModulePath.set(true)
}
}
end my module-info.java is
module io.vincenzopalazzo.client.main {
requires io.vincenzopalazzo.lib;
}
My question is now, my method to support the JPMS inside the module example is correct or with gradle 6.4 there is something else?
In conclusion, Is correct my method to use the local module inside the client app?
Thanks for your time.