Migrated from Kotlin script to Groovy as couldn't figure out how to create fat jar with Kotlin script

This commit is contained in:
dankito 2020-11-16 02:19:12 +01:00
parent 9d8c8f7c5b
commit 7a327d5a8f
3 changed files with 51 additions and 71 deletions

View File

@ -0,0 +1,49 @@
apply plugin: 'kotlin'
apply plugin: 'application'
group = "net.codinux.banking.epcqrcode.javafx"
mainClassName = "net.codinux.banking.epcqrcode.EpcQrCodeJavaFxAppKt"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileKotlin {
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8
}
compileTestKotlin {
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
api project(":EpcQrCode")
implementation "net.dankito.utils:java-fx-utils:1.0.8"
}
jar {
zip64 = true
// If one of the source JARs is signed, merging it into one fat jar destroys the signature -> remove signatures
// (but may runs into problems with jars that require a valid signature like BouncyCastle, see
// https://stackoverflow.com/questions/51455197/gradle-fatjar-could-not-find-or-load-main-class)
exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA")
manifest {
attributes 'Main-Class': mainClassName,
'Implementation-Title': "EPC QR Code",
'Implementation-Version': "1.0.0-SNAPSHOT"
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
}

View File

@ -1,71 +0,0 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm")
application
}
group = "net.codinux.banking.epcqrcode.javafx"
val mainClassName = "net.codinux.banking.epcqrcode.EpcQrCodeJavaFxAppKt"
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "1.8"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "1.8"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile>() {
kotlinOptions.jvmTarget = "1.8"
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
api(project(":EpcQrCode"))
implementation("net.dankito.utils:java-fx-utils:1.0.8")
}
application {
mainClassName = mainClassName
}
tasks.withType<Jar> {
isZip64 = true
// If one of the source JARs is signed, merging it into one fat jar destroys the signature -> remove signatures
// (but may runs into problems with jars that require a valid signature like BouncyCastle, see
// https://stackoverflow.com/questions/51455197/gradle-fatjar-could-not-find-or-load-main-class)
exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA")
manifest {
attributes(mapOf(
"Main-Class" to mainClassName,
"Implementation-Title" to "EPC QR Code",
"Implementation-Version" to "1.0.0-SNAPSHOT"
))
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
// To add all of the dependencies
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}

View File

@ -3,4 +3,6 @@ kotlin.js.generate.executable.default=false
xcodeproj=./EpcQrCodeiOSApp xcodeproj=./EpcQrCodeiOSApp
kotlinVersion=1.4.10
quarkusVersion=1.8.2.Final quarkusVersion=1.8.2.Final