-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
86 lines (75 loc) · 2.53 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
/*
* This file was generated by the Gradle 'init' task.
*/
allprojects {
group = 'org.example'
version = '1.0.0-SNAPSHOT'
}
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
repositories {
// mavenLocal()
mavenCentral()
}
dependencies {
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
}
sourceCompatibility = '1.8'
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
test {
useJUnitPlatform()
testLogging {
showExceptions = true
showStandardStreams = true
events(
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED,
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED,
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
)
}
}
[clean, compileJava].each {
it.dependsOn('process-resources')
}
tasks.create(name: 'process-resources') {
shouldRunAfter("clean", "compileJava")
doFirst {
def basePath = projectDir.getPath()
// copy correct logback.xml
def xml = java.nio.file.Paths.get(basePath, "src", "main", "resources", "logback.gradle.xml")
if (xml.toFile().exists()) {
java.nio.file.Files.copy(
xml,
java.nio.file.Paths.get(basePath, "src", "main", "resources", "logback.xml"),
java.nio.file.StandardCopyOption.REPLACE_EXISTING
)
println "copied: $xml"
}
// copy correct Dockerfile
def dockerfile = java.nio.file.Paths.get(basePath, "Dockerfile.gradle")
if (dockerfile.toFile().exists()) {
java.nio.file.Files.copy(
dockerfile,
java.nio.file.Paths.get(basePath, "Dockerfile"),
java.nio.file.StandardCopyOption.REPLACE_EXISTING
)
println "copied: $dockerfile"
}
}
}
}
// anyway, use: ./gradlew build -p ui ; ./gradlew
defaultTasks('clean', 'process-resources', 'ui:war', 'build')