83 lines
2.0 KiB
Kotlin
83 lines
2.0 KiB
Kotlin
plugins {
|
||
id("java")
|
||
id("application")
|
||
id("maven-publish")
|
||
}
|
||
|
||
group = "com.r35157.nenjim"
|
||
version = project.findProperty("version") ?: "UNSET"
|
||
if (version == "UNSET" && gradle.startParameter.taskNames.any { it.startsWith("publish") }) {
|
||
throw GradleException("You must set -Pversion=... (use publish.sh / publishCICD.sh)")
|
||
}
|
||
|
||
application {
|
||
mainClass.set("com.r35157.nenjim.hubd.impl.ref.Main")
|
||
}
|
||
|
||
repositories {
|
||
mavenLocal()
|
||
|
||
maven {
|
||
name = "Artifacts"
|
||
url = uri("/mnt/artifacts/java")
|
||
|
||
// Failsafe for Android variant-aware deps + klassiske Maven-artefakter:
|
||
metadataSources {
|
||
gradleMetadata() // bevar .module for Android/AAR varianter
|
||
mavenPom()
|
||
artifact()
|
||
}
|
||
}
|
||
|
||
mavenCentral()
|
||
}
|
||
|
||
dependencies {
|
||
implementation(platform("org.apache.logging.log4j:log4j-bom:2.25.2"))
|
||
implementation("org.apache.logging.log4j:log4j-api")
|
||
runtimeOnly("org.apache.logging.log4j:log4j-core")
|
||
compileOnly("org.jetbrains:annotations:26.0.2-1")
|
||
|
||
implementation("com.r35157.nenjim:hubd-api:0.0-dev")
|
||
implementation("org.apache.poi:poi-ooxml:5.5.1")
|
||
}
|
||
|
||
java {
|
||
toolchain { languageVersion.set(JavaLanguageVersion.of(24)) }
|
||
}
|
||
|
||
val dockerLibsDir = layout.buildDirectory.dir("docker/libs")
|
||
|
||
tasks.register<Sync>("prepareDockerLibs") {
|
||
group = "distribution"
|
||
description = "Copies all runtime dependencies (transitive) to build/docker/libs"
|
||
|
||
// Hvis du også vil bygge dit eget jar samtidig, så lad den stå – ellers kan du fjerne den.
|
||
dependsOn(tasks.named("jar"))
|
||
|
||
into(dockerLibsDir)
|
||
|
||
// Kun deps (transitivt)
|
||
from(configurations.runtimeClasspath)
|
||
|
||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||
}
|
||
|
||
tasks.withType<JavaCompile> {
|
||
options.release.set(24)
|
||
}
|
||
|
||
publishing {
|
||
publications {
|
||
create<MavenPublication>("mavenJava") {
|
||
from(components["java"])
|
||
}
|
||
}
|
||
repositories {
|
||
maven {
|
||
name = "Artifacts"
|
||
url = uri("/mnt/artifacts/java")
|
||
}
|
||
}
|
||
}
|