Configure jar task to build fat jar archives

This commit is contained in:
2020-03-09 18:44:25 +01:00
parent 4fea93cdf9
commit ae9406cc50

View File

@@ -13,9 +13,10 @@ repositories {
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
runtime group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.3.61'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.3.61'
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'org.pf4j', name: 'pf4j', version: '3.2.0'
}
compileKotlin {
@@ -23,4 +24,23 @@ compileKotlin {
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
jar {
zip64 true
manifest {
attributes 'Main-Class': 'io.smnp.SMNPKt'
}
// This line of code recursively collects and copies all of a project's files
// and adds them to the JAR itself. One can extend this task, to skip certain
// files or particular types at will
from configurations.compile.collect {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
it.isDirectory() ? it : zipTree(it)
}
from files(sourceSets.main.output.classesDirs)
from files(sourceSets.main.resources)
}