Closed Burtan closed 4 years ago
@Burtan can you upgrade to Kotlin 1.4? It is supposed to have full module descriptors in all jars.
I can do that, it's mostly dependencies that use <1.4, so I have to exclude those.
Just as a real world example, this is the most part of my gradle file, the app/tests now build.
import java.io.ByteArrayOutputStream
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.internal.os.OperatingSystem
allprojects {
repositories {
jcenter()
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
maven { url = uri("https://dl.bintray.com/reactivex/RxJava") }
}
}
plugins {
application
kotlin("jvm") version "1.4.10"
id("org.beryx.jlink") version "2.22.1"
id("de.jjohannes.extra-java-module-info") version "0.1"
}
// add module information for all direct and transitive depencies that are not modules
extraJavaModuleInfo {
automaticModule("simple-xml-2.7.1.jar", "simple.xml")
automaticModule("rxkotlinfx-2.2.2.jar", "rxkotlinfx")
automaticModule("rxkotlin-2.4.0.jar", "rxkotlin")
automaticModule("kotlin-stdlib-common-1.4.10.jar", "kotlin.stdlib.common")
automaticModule("annotations-13.0.jar", "annotations")
automaticModule("xpp3-1.1.3.3.jar", "xpp3")
automaticModule("kotlintest-runner-junit5-3.4.2.jar", "")
automaticModule("kotlintest-runner-console-3.4.2.jar", "")
automaticModule("kotlintest-runner-jvm-3.4.2.jar", "")
automaticModule("kotlintest-core-3.4.2.jar", "")
automaticModule("kotlintest-assertions-3.4.2.jar", "")
automaticModule("kotlinx-coroutines-core-1.1.1.jar", "")
automaticModule("mordant-1.2.1.jar", "")
automaticModule("arrow-core-extensions-0.9.0.jar", "")
automaticModule("arrow-typeclasses-0.9.0.jar", "")
automaticModule("arrow-core-data-0.9.0.jar", "")
automaticModule("kotlin-stdlib-jdk7-1.3.11.jar", "")
automaticModule("arrow-annotations-0.9.0.jar", "")
automaticModule("colormath-1.2.0.jar", "")
automaticModule("mockito-junit-jupiter-3.2.4.jar", "")
automaticModule("truth-1.0.1.jar", "")
automaticModule("kotlinx-coroutines-core-common-1.1.1.jar", "")
automaticModule("junit-4.12.jar", "")
automaticModule("diffutils-1.3.0.jar", "")
automaticModule("auto-value-annotations-1.6.3.jar", "")
automaticModule("error_prone_annotations-2.3.3.jar", "")
automaticModule("slf4j-api-1.7.25.jar", "")
automaticModule("univocity-parsers-2.8.1.jar", "")
automaticModule("diffutils-2.2.jar", "")
automaticModule("kotlintest-extensions-3.4.2.jar", "")
automaticModule("argparse4j-0.8.1.jar", "")
automaticModule("objenesis-2.6.jar", "")
automaticModule("failureaccess-1.0.1.jar", "")
automaticModule("listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar", "")
automaticModule("jsr305-3.0.2.jar", "")
automaticModule("j2objc-annotations-1.3.jar", "")
automaticModule("animal-sniffer-annotations-1.18.jar", "")
automaticModule("hamcrest-core-1.3.jar", "")
automaticModule("org.eclipse.jgit-4.4.1.201607150455-r.jar", "")
automaticModule("kindedj-1.1.0.jar", "")
automaticModule("mockk-1.9.1.jar", "")
automaticModule("mockk-agent-jvm-1.9.1.jar", "")
automaticModule("mockk-common-1.9.1.jar", "")
automaticModule("mockk-dsl-jvm-1.9.1.jar", "")
automaticModule("mockk-dsl-1.9.1.jar", "")
automaticModule("mockk-agent-common-1.9.1.jar", "")
automaticModule("mockk-agent-api-1.9.1.jar", "")
}
val test by tasks.getting(Test::class) {
useJUnitPlatform { }
}
val compileKotlin: KotlinCompile by tasks
val compileTestKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "1.8"
}
compileTestKotlin.kotlinOptions {
jvmTarget = "1.8"
}
java {
modularity.inferModulePath.set(true)
}
dependencies {
testImplementation("io.kotlintest:kotlintest-runner-junit5:3.4.2") {
exclude("org.jetbrains.kotlin")
}
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
testImplementation("org.mockito:mockito-junit-jupiter:3.2.4")
testImplementation("com.google.truth:truth:1.0.1")
//kotlin
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.4.10")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.4.10")
//ReactiveX
implementation("io.reactivex.rxjava2:rxjavafx:2.11.0-RC34") {
exclude("org.openjfx")
}
implementation("io.reactivex.rxjava2:rxjava:2.2.19")
implementation("com.github.thomasnield:rxkotlinfx:2.2.2") {
exclude("org.openjfx")
exclude("org.jetbrains.kotlin")
}
implementation("io.reactivex.rxjava2:rxkotlin:2.4.0")
//TornadoFX
implementation("no.tornado:tornadofx:2.0.0-SNAPSHOT") {
exclude("org.jetbrains.kotlin")
exclude("org.openjfx")
}
//controlsFX, for Font selection
implementation("org.controlsfx", "controlsfx", "11.0.2") {
exclude("org.openjfx")
}
//xml
implementation("org.simpleframework:simple-xml:2.7.1") {
exclude("stax.api")
exclude("stax")
}
val jfxOptions = object {
val group = "org.openjfx"
val version = "15"
val fxModules = arrayListOf(
"javafx-base",
"javafx-controls",
"javafx-graphics",
"javafx-media",
"javafx-swing",
"javafx-web",
"javafx-fxml"
)
}
jfxOptions.run {
val osName = System.getProperty("os.name")
val platform = when {
osName.startsWith("Mac", ignoreCase = true) -> "mac"
osName.startsWith("Windows", ignoreCase = true) -> "win"
osName.startsWith("Linux", ignoreCase = true) -> "linux"
else -> "mac"
}
fxModules.forEach {
implementation("$group:$it:$version:$platform")
}
}
}
@Burtan version 0.3
of the plugin now has an option to disable the error. Jars without any infos then stay untouched.
extraJavaModuleInfo {
failOnMissingModuleInfo.set(false)
}
Hi, I have troubles running my modular app with different dependencies. While many legacy jars have an automatic module name, I have to use this plugin to be able to use org.simpleframework.simple-xml. This works, but now I have to add custom module info for every dependency that just worked before adding this plugin.
This can easily be 100+ entries. Wouldn't it be reasonable to automatically generate the automaticModule info base on the jar name? For the example abouve this would be: