generated from Foulest/JavaTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
97 lines (79 loc) · 2.02 KB
/
build.gradle
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'maven-publish'
id 'application'
id 'java'
}
group = 'net.foulest'
version = '1.0.2'
description = 'Swiss'
// Set the project's language level
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
repositories {
// Maven central repository
mavenCentral()
mavenLocal()
// Local libraries
flatDir {
dirs 'libs'
}
}
dependencies {
// JetBrains Annotations - for code inspection and documentation
// https://mvnrepository.com/artifact/org.jetbrains/annotations
compileOnly group: 'org.jetbrains', name: 'annotations', version: '26.0.2'
// Lombok - for reducing boilerplate code
// https://projectlombok.org
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.36'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.36'
}
tasks {
jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName.set("${project.name}-${project.version}-default.jar")
// Set the 'Main-Class' attribute in the JAR manifest
manifest {
attributes 'Main-Class': 'net.foulest.swiss.Main'
}
}
shadowJar {
mainClassName = 'net.foulest.swiss.Main'
archiveFileName.set("${project.name}-${project.version}.jar")
}
compileJava {
dependsOn(clean)
options.encoding = 'UTF-8'
}
build {
dependsOn(shadowJar)
}
distZip {
dependsOn(shadowJar)
}
distTar {
dependsOn(shadowJar)
}
startScripts {
dependsOn(shadowJar)
}
startShadowScripts {
dependsOn(jar)
}
tasks.register('sourceJar', Jar) {
from sourceSets.main.allJava
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'net.foulest.swiss'
artifactId = project.name
version = project.version
from components.java
}
}
}