-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
53 lines (45 loc) · 1.5 KB
/
build.gradle
File metadata and controls
53 lines (45 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
plugins {
id 'java-library'
}
group = 'de.hanneseilers.jserial'
version = '0.0.5'
repositories {
mavenCentral()
}
dependencies {
api 'org.apache.logging.log4j:log4j-core:2.25.1'
implementation 'org.apache.logging.log4j:log4j-api:2.25.1'
implementation fileTree("libs") { include "*.jar" }
}
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
// task building fat jar with all dependencies
tasks.register('buildLib', Jar) {
manifest {
attributes 'Main-Class': 'com.baeldung.fatjar.Application'
}
destinationDirectory.set(layout.projectDirectory.asFile)
archiveBaseName = 'jSerial'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
// task zipping lib-sources
tasks.register('zipLibSources', Zip) {
description = 'Packs lib-sources directory into a versioned zip at project root'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from('lib-sources') { into('lib-sources') }
archiveBaseName.set('lib-sources')
archiveVersion.set(project.version.toString())
destinationDirectory.set(layout.projectDirectory.asFile)
}
// task build fat jar and lib-sources zip
tasks.register('releaseBundle') {
group = 'build'
description = 'Build fat JAR and lib-sources zip into project root'
dependsOn(tasks.buildLib, tasks.zipLibSources)
}