forked from apache/roller
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
194 lines (162 loc) · 5.24 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// tasks: spotbugsMain, spotbugsTest, spotbugsIntegrationTest or "check" for all
plugins {
id 'java-library'
id "io.spring.dependency-management" version "1.1.3"
id "com.github.spotbugs" version "4.7.3"
// ./gradlew dependencyUpdates
id "com.github.ben-manes.versions" version "0.48.0"
id 'com.github.node-gradle.node' version '5.0.0'
id 'war'
id "org.springframework.boot" version "2.7.16"
id "checkstyle"
// run jacoco via gradle jacocoTestReport, report in build/reports
id 'jacoco'
}
group = 'org.tightblog'
version = '4.0.0'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
}
sourceSets {
test {
java {
srcDir 'src/test/java'
exclude '**/*IT.java'
}
}
// https://docs.gradle.org/current/userguide/java_testing.html#sec:configuring_java_integration_tests
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/test/java')
// include '**/UserManagerIT.java'
include '**/*IT.java'
}
resources.srcDir file('src/test/resources')
}
}
static def standardCompile(options) {
options.compilerArgs += ["-proc:none", "-Xlint:unchecked"]
}
compileJava {
standardCompile(options)
}
compileTestJava {
standardCompile(options)
}
compileIntegrationTestJava {
standardCompile(options)
}
project.ext.buildNumber = java.time.Instant.now().getEpochSecond()
def standardProcessResources(obj) {
obj.filesMatching(['application.properties', 'application-tbcustom.properties']) {
expand(version: version,
buildNumber: buildNumber,
buildDir: buildDir
)
}
}
processResources {
standardProcessResources(processResources)
}
processTestResources {
standardProcessResources(processTestResources)
}
processIntegrationTestResources {
standardProcessResources(processIntegrationTestResources)
}
configurations {
integrationTestImplementation.extendsFrom implementation, testImplementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly
// using log4j2 instead of logback
// global excludes: http://mrhaki.blogspot.com/2012/10/gradle-goodness-exclude-transitive.html
all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
task integrationTest(type: Test) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
mustRunAfter test
}
check.dependsOn integrationTest
spotbugs {
excludeFilter = file("$rootProject.projectDir/etc/buildconfig/spotbugsExcludes.xml")
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa") {
exclude group: "org.hibernate", module: "hibernate-entitymanager"
}
implementation('org.springframework.boot:spring-boot-starter-security')
implementation('org.springframework.boot:spring-boot-starter-thymeleaf')
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-mail')
implementation('org.springframework.boot:spring-boot-starter-log4j2')
implementation('org.springframework.boot:spring-boot-starter-validation')
implementation('org.springframework.security:spring-security-taglibs')
implementation('org.eclipse.persistence:org.eclipse.persistence.jpa:2.7.9')
implementation('org.apache.commons:commons-lang3:3.13.0')
implementation('org.apache.commons:commons-text:1.10.0')
implementation('org.apache.lucene:lucene-analyzers-common:8.6.2')
implementation('org.apache.lucene:lucene-queryparser:8.6.2')
implementation('javax.servlet:jstl:1.2')
implementation('commons-validator:commons-validator:1.7')
implementation('org.jsoup:jsoup:1.16.1')
implementation('com.github.ben-manes.caffeine:caffeine:3.1.8')
implementation('org.jboss.aerogear:aerogear-otp-java:1.0.0')
implementation('com.atlassian.commonmark:commonmark:0.17.0')
implementation('commons-fileupload:commons-fileupload:1.5')
implementation('org.apache.derby:derbyclient:10.15.2.0')
testImplementation('org.springframework.boot:spring-boot-starter-test')
runtimeOnly('org.apache.derby:derby:10.16.1.1')
// PostgreSQL JDBC jar, can remove if using other databases.
runtimeOnly('org.postgresql:postgresql')
providedCompile('org.apache.tomcat.embed:tomcat-embed-jasper:9.0.11')
// https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
}
def uiDir = 'src/client3'
node {
version = '18.0.0'
npmVersion = '6.14.9'
download = true
// distBaseUrl = Custom artifactory location here for node/npm.
}
task npmInstallBloggerUI(type: NpmTask) {
args = ['install']
execOverrides {
it.workingDir = uiDir
}
}
task npmBuildBloggerUI(type: NpmTask) {
dependsOn npmInstallBloggerUI
args = ['run','build']
execOverrides {
it.workingDir = uiDir
}
}
task deleteUi(type: Delete) {
delete 'src/main/webapp/tb-ui'
followSymlinks = false
}
task copyUi(type: Copy) {
dependsOn npmBuildBloggerUI
into "src/main/webapp"
into("tb-ui") {
from "${uiDir}/dist"
}
}
war {
enabled = true
}
war.dependsOn copyUi
copyUi.dependsOn deleteUi
bootWar.dependsOn copyUi