Remove fat jar module and use java standard library

Removes usage of org.apache.commons classes and instead relies on functionality of Java itself.
It also removes the now-unnecessary plugin dependency for shadowJars.
This commit is contained in:
Jonas Tobias Hopusch 2022-01-28 02:06:45 +01:00
parent 6b064eb806
commit 28a461b8fc
Failed to generate hash of commit

View file

@ -1,16 +1,24 @@
import java.io.ByteArrayOutputStream
import java.io.OutputStream
plugins { plugins {
// Apply the application plugin to add support for building a CLI application in Java. // Apply the application plugin to add support for building a CLI application in Java.
application application
java
}
// For generating fat jars repositories {
id("com.github.johnrengelman.shadow") version "latest.release" // Use Maven Central for resolving dependencies.
mavenCentral()
} }
fun versionBanner(): String { fun versionBanner(): String {
val os = org.apache.commons.io.output.ByteArrayOutputStream() val os = ByteArrayOutputStream()
val devNull = OutputStream.nullOutputStream()
project.exec { project.exec {
commandLine = "git describe --always --dirty".split(" ") commandLine = "git describe --tags --always --dirty --abbrev".split(" ")
standardOutput = os standardOutput = os
errorOutput = devNull
} }
return String(os.toByteArray()).trim() return String(os.toByteArray()).trim()
} }
@ -18,11 +26,6 @@ fun versionBanner(): String {
group = "de.jotoho" group = "de.jotoho"
version = versionBanner() version = versionBanner()
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
java { java {
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17