Skip to content

Instantly share code, notes, and snippets.

@pavelgordon
Last active September 8, 2020 20:51
Show Gist options
  • Save pavelgordon/cdbe5d1d350590ac1d96f06ffa1bdd0c to your computer and use it in GitHub Desktop.
Save pavelgordon/cdbe5d1d350590ac1d96f06ffa1bdd0c to your computer and use it in GitHub Desktop.
Build fat-jar/uber-jar(standalone executablejar file with all depencdencies). Run "shadowJar" task from gradle, and then see your jar at build/libs/app-0.0.1-all.jar
plugins {
id 'com.github.johnrengelman.shadow' version '6.0.0'
id 'java'
}
group 'dev.pgordon'
version '0.1.0'
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
mavenContent {
snapshotsOnly()
}
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}
jar {
manifest {
attributes 'Main-Class': 'dev.pgordon.MainKt' //replace with your path
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment