-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
62 lines (49 loc) · 1.46 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
import org.apache.tools.ant.filters.ReplaceTokens
apply plugin: 'java'
apply plugin: 'war'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
task distJavadocZip(type: Zip, dependsOn: javadoc) {
archiveBaseName = "${project.distsDirectory.get()}/${project.archivesBaseName}-javadoc"
from files(javadoc.destinationDir)
}
tasks.build.dependsOn(distJavadocZip)
repositories {
mavenCentral()
}
dependencies {
compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
runtimeOnly 'org.postgresql:postgresql:42.2.12'
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2'
}
// Must explicitly enable jUnit 5
test {
useJUnitPlatform()
}
def dbProps = new Properties()
file("db.properties").withInputStream { dbProps.load(it) }
task processResourcesDB(type: Copy) {
from 'src/main/db'
into "${project.buildDir}/db"
filter(ReplaceTokens, tokens: dbProps, beginToken : '${', endToken : '}')
filteringCharset = 'UTF-8'
}
processResources.dependsOn(processResourcesDB)
task assembleDB(type: Zip, dependsOn: processResourcesDB) {
archiveFileName = 'db.zip'
from "$buildDir/db"
destinationDirectory = project.libsDirectory
}
assemble.dependsOn(assembleDB);
war {
filesMatching('/META-INF/context.xml') {
filter(ReplaceTokens, tokens: dbProps, beginToken : '${', endToken : '}')
}
}
task deploy(type: Copy, dependsOn: war) {
from war.archivePath
into "${tomcatHome}/webapps"
}