This repository has been archived by the owner on Mar 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
76 lines (65 loc) · 2.51 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
import java.text.SimpleDateFormat
plugins {
id("com.github.johnrengelman.shadow") version "6.1.0"
id("io.micronaut.application") version "1.5.0"
}
version = "1.5"
group = "com.spencercjh"
repositories {
mavenCentral()
}
micronaut {
testRuntime("junit5")
processing {
incremental(true)
annotations("com.spencercjh.*")
}
}
dependencies {
annotationProcessor 'org.projectlombok:lombok'
annotationProcessor("info.picocli:picocli-codegen")
compileOnly 'org.projectlombok:lombok'
implementation("info.picocli:picocli")
implementation("io.micronaut:micronaut-runtime")
implementation("io.micronaut.picocli:micronaut-picocli")
implementation("javax.annotation:javax.annotation-api")
implementation("org.apache.logging.log4j:log4j-core:2.13.3")
// https://mvnrepository.com/artifact/org.apache.poi/poi
implementation group: 'org.apache.poi', name: 'poi', version: '5.0.0'
// https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '5.0.0'
// https://mvnrepository.com/artifact/com.google.guava/guava
implementation group: 'com.google.guava', name: 'guava', version: '30.1.1-jre'
runtimeOnly("org.apache.logging.log4j:log4j-api:2.13.3")
runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.13.2")
testAnnotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
}
application {
mainClass.set("com.spencercjh.DivideSquadCommand")
}
java {
sourceCompatibility = JavaVersion.toVersion("8")
targetCompatibility = JavaVersion.toVersion("8")
}
// reference: https://github.com/remkop/picocli/blob/5ee80a3ff1bc1d3ac0e326a6be8a1b8c06b9f50b/picocli-examples/build.gradle#L51
def generatedResources = "$buildDir/generated-resources/main"
sourceSets {
main {
//register an output folder on the main SourceSet:
output.dir(generatedResources, builtBy: 'generateVersionTxt')
//it is now a part of the 'main' classpath and will be a part of the jar
}
}
task generateVersionTxt {
description 'Creates a version.txt file with build info that is added to the root of the picocli-examples jar'
doLast {
new File(generatedResources).mkdirs()
def generated = new File(generatedResources, "version.txt")
generated.text = """
Version: $rootProject.version
Buildtime: ${new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())}
Application-name: $rootProject.name $project.name
"""
}
}