Skip to content

Commit b258e53

Browse files
authored
Merge pull request eugenp#3191 from mkuligowski/master
BAEL-1347
2 parents d562f42 + e75a143 commit b258e53

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

‎gradle/gradle-fat-jar/build.gradle‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
}
5+
dependencies {
6+
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
7+
}
8+
}
9+
10+
apply plugin: 'java'
11+
apply plugin: 'com.github.johnrengelman.shadow'
12+
13+
repositories {
14+
mavenCentral()
15+
}
16+
17+
jar {
18+
manifest {
19+
attributes "Main-Class": "com.baeldung.fatjar.Application"
20+
}
21+
22+
from {
23+
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
24+
}
25+
}
26+
27+
28+
task customFatJar(type: Jar) {
29+
manifest {
30+
attributes 'Main-Class': 'com.baeldung.fatjar.Application'
31+
}
32+
baseName = 'all-in-one-jar'
33+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
34+
with jar
35+
}
36+
37+
38+
dependencies{
39+
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
40+
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
41+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.baeldung.fatjar;
2+
3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
6+
7+
public class Application {
8+
9+
static final Logger logger = LoggerFactory.getLogger(Application.class);
10+
11+
public static void main(String[] args) {
12+
13+
logger.info("Hello at Baeldung!");
14+
}
15+
16+
}

0 commit comments

Comments
 (0)