-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
91 lines (79 loc) · 2.43 KB
/
build.gradle
File metadata and controls
91 lines (79 loc) · 2.43 KB
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
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.3'
id 'io.spring.dependency-management' version '1.1.5'
id 'jacoco'
}
group = 'com.project03'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
}
dependencies {
// Application
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
// Runtime DB (Supabase Postgres)
runtimeOnly 'org.postgresql:postgresql'
// Testing
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.mockito:mockito-core:5.14.2'
testImplementation 'org.mockito:mockito-junit-jupiter:5.14.2'
testRuntimeOnly 'com.h2database:h2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
/**
* BootRun Quality-of-Life (Team Friendly)
* - Always run with dev profile when using `bootRun`
* - Auto-load environment variables from a local `.env` file (NOT committed)
*
* Create a `.env` file in the backend root (same folder as gradlew) like:
* GITHUB_CLIENT_SECRET=your_secret_here
*
* Add `.env` to .gitignore so secrets never go to GitHub.
*/
tasks.named("bootRun") {
// No need to pass: --args="--spring.profiles.active=dev"
systemProperty "spring.profiles.active", "dev"
doFirst {
def envFile = file(".env")
if (envFile.exists()) {
envFile.readLines()
.findAll { line ->
line != null &&
line.trim() &&
!line.trim().startsWith("#") &&
line.contains("=")
}
.each { line ->
def (k, v) = line.split("=", 2)
environment k.trim(), v.trim()
}
}
}
}
tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport)
}
jacoco {
toolVersion = "0.8.12"
}
tasks.jacocoTestReport {
dependsOn tasks.test
reports {
xml.required = true
html.required = true
}
}
tasks.register("stage") {
dependsOn("clean", "bootJar")
}