From ae9406cc5089bed2c60df1cd2161a0dd946ed1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Przemys=C5=82aw=20Pluta?= Date: Mon, 9 Mar 2020 18:44:25 +0100 Subject: [PATCH] Configure jar task to build fat jar archives --- build.gradle | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index fa563b6..d070c22 100644 --- a/build.gradle +++ b/build.gradle @@ -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) } \ No newline at end of file