Reputation: 201
I'm trying to package an application using Ehcache and when I run ./gradlew jlink
I get an error. The createMergedModule
task fails with module not found: java.activation
Here is my minimal build.gradle (tried with 7.6.1, 8.5, 8.6, same results) :
plugins {
id "java"
id "org.beryx.jlink" version "3.0.1"
id "org.gradlex.extra-java-module-info" version "1.8"
}
group = 'org.example'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
// https://mvnrepository.com/artifact/org.ehcache/ehcache
implementation group: 'org.ehcache', name: 'ehcache', version: '3.10.8'
implementation group: 'javax.activation', name: 'javax.activation-api', version: '1.2.0'
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
test {
useJUnitPlatform()
}
jlink {
addExtraDependencies("javax.activation")
}
extraJavaModuleInfo {
automaticModule("ehcache-3.10.8.jar", "ehcache")
automaticModule("cache-api-1.1.0.jar", "cache.api")
automaticModule("javax.activation-api-1.2.0.jar", "java.activation") {
mergeJar("javax.activation:javax.activation-api")
}
}
And my module-info.java
module cache.main {
requires ehcache;
// requires java.activation; // <-- compile error if automaticModule() is used.
}
I've tried adding forceMerge()
and addExtraDependencies()
options in jlink{}; adding several different dependencies; using org.javamodularity.moduleplugin
instead of org.gradlex.extra-java-module-info
and I still get the same error.
The MANIFEST.MF in javax.activation-api-1.2.0.jar
lists Automatic-Module-Name: java.activation
.
Shouldn't jlink use that when creating the merged module?
I've written some code to test ehcache and the code builds and runs fine, but JLink and JPackage tasks fail.
Upvotes: 0
Views: 88