java-tutorials/gradle-modules/gradle/gradle-fat-jar/build.gradle

49 lines
1.1 KiB
Groovy
Raw Normal View History

buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath "gradle.plugin.com.github.johnrengelman:shadow:7.1.2"
}
}
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
jar {
manifest {
attributes "Main-Class": "com.baeldung.fatjar.Application"
}
from {
2022-06-13 15:31:44 -04:00
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
task customFatJar(type: Jar) {
manifest {
attributes 'Main-Class': 'com.baeldung.fatjar.Application'
}
archiveBaseName = 'all-in-one-jar'
2022-06-13 15:31:44 -04:00
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
dependencies{
2022-06-13 15:31:44 -04:00
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
}