| plugins { |
| // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. |
| id 'org.jetbrains.kotlin.jvm' version '2.2.21' |
| |
| // Apply the application plugin to add support for building a CLI application in Java. |
| id 'application' |
| id 'com.github.johnrengelman.shadow' version '8.1.1' |
| } |
| |
| repositories { |
| mavenCentral() |
| maven { url 'https://jitpack.io' } |
| } |
| |
| test { |
| minHeapSize = "512m" |
| maxHeapSize = "4096m" |
| jvmArgs '-XX:MaxMetaspaceSize=1024m' |
| } |
| |
| dependencies { |
| // Align versions of all Kotlin components |
| implementation platform('org.jetbrains.kotlin:kotlin-bom') |
| |
| // Use the Kotlin JDK 8 standard library. |
| implementation 'org.jetbrains.kotlin:kotlin-stdlib' |
| implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2' |
| |
| // This dependency is used by the application. |
| implementation 'com.google.guava:guava:33.5.0-jre' |
| |
| |
| implementation ("info.picocli:picocli:4.7.7") |
| |
| // Use the Kotlin test library. |
| testImplementation 'org.jetbrains.kotlin:kotlin-test' |
| |
| // Use the Kotlin JUnit integration. |
| testImplementation 'org.jetbrains.kotlin:kotlin-test-junit' |
| testImplementation "org.jetbrains.kotlin:kotlin-test:2.2.21" |
| |
| implementation 'com.github.kupietz:cistern:v1.0.4' |
| implementation 'org.maltparser:maltparser:1.9.2' |
| implementation 'org.apache.opennlp:opennlp-tools:2.5.6' |
| implementation 'org.slf4j:slf4j-simple:2.0.17' |
| implementation 'org.apache.ant:ant:1.10.15' |
| implementation 'org.apache.commons:commons-compress:1.28.0' |
| |
| } |
| |
| // Erzwinge JDK 21 Toolchain und Bytecode-Level 21 |
| java { |
| toolchain { |
| languageVersion = JavaLanguageVersion.of(21) |
| } |
| } |
| |
| kotlin { |
| jvmToolchain(21) |
| } |
| |
| // Für evtl. vorhandenen Java-Quellcode |
| tasks.withType(JavaCompile).configureEach { |
| options.release = 21 |
| } |
| |
| tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { |
| kotlinOptions { |
| jvmTarget = "21" |
| // Falls verfügbar, sorgt dies für konsistente API-Targets ähnlich zu Java --release |
| // freeCompilerArgs += ["-Xjdk-release=21"] |
| } |
| } |
| |
| // Version des Subprojekts explizit von Root erben |
| version = rootProject.version |
| |
| application { |
| // Define the main class for the application. |
| mainClass = 'de.ids_mannheim.korapxmltools.KorapXmlToolKt' |
| } |
| |
| jar { |
| // Standard-JAR als "plain" kennzeichnen, um Konflikte mit ShadowJar zu vermeiden |
| archiveClassifier.set('plain') |
| manifest.attributes( |
| 'Class-Path': configurations.compileClasspath.collect { it.getName() }.join(' '), |
| 'Main-Class': "de.ids_mannheim.korapxmltools.KorapXmlToolKt", |
| 'Implementation-Title': rootProject.name, |
| 'Implementation-Version': project.version |
| ) |
| } |
| |
| shadowJar { |
| archiveBaseName.set('korapxmltool') |
| archiveClassifier.set('') |
| archiveVersion.set(project.version.toString()) |
| manifest.attributes( |
| 'Main-Class': "de.ids_mannheim.korapxmltools.KorapXmlToolKt", |
| 'Implementation-Title': rootProject.name, |
| 'Implementation-Version': project.version |
| ) |
| } |
| |
| // Stelle sicher, dass assemble auch den ShadowJar erzeugt |
| tasks.named('assemble') { |
| dependsOn tasks.named('shadowJar') |
| } |
| |
| // Erzeuge zusätzlich eine nicht-versionierte Kopie korapxmltool.jar für stabile Skriptpfade |
| tasks.register('shadowJarLatest', Copy) { |
| dependsOn tasks.named('shadowJar') |
| from({ tasks.shadowJar.get().archiveFile.get().asFile }) |
| into({ tasks.shadowJar.get().destinationDirectory.get().asFile }) |
| rename { String _ -> 'korapxmltool.jar' } |
| } |
| |
| tasks.named('build') { |
| dependsOn tasks.named('shadowJarLatest') |
| } |
| |
| |
| configurations { |
| runtimeLib.extendsFrom implementation |
| } |