-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
49 lines (40 loc) · 2.26 KB
/
build.gradle.kts
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
plugins {
java
application
}
val springBootVersion = "3.3.1" // https://spring.io/projects/spring-boot#learn
repositories {
mavenCentral()
}
dependencies {
/*
Import the Spring Boot Maven BOM. This is convenient because we get automatic version inference for all other Spring
and Spring-related dependency declarations. See https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#managing-dependencies
Gradle natively supports importing Maven BOMs. See https://docs.gradle.org/current/userguide/platforms.html#sub:bom_import
F.A.Q
Q: Why not use the Spring Boot Gradle plugin?
A: Because we are comfortable using the built-in Gradle 'application' plugin.
Q: What is the difference between the 'application' plugin and the Spring Boot plugin?
A: Among other things the Spring Boot plugin creates an executable (a.k.a. "fat) JAR. It also defines a 'bootRun'
Gradle task that runs the executable JAR. By contrast, the 'application' plugin does not make an executable JAR
and instead generates a shell "start script" that can be used to run the application.
Q: Should I use an executable JAR or a start scripts?
A: It is mostly a matter of preference. I find that Gradle's incremental build feature works more effectively when
using the 'application' plugin compared to using the Spring Boot plugin. I think this is because the Spring Boot
plugin has to make a whole JAR for any change to the project whereas the 'application' plugin does not have to
pay that cost.
*/
implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion"))
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-cache")
implementation("com.github.ben-manes.caffeine:caffeine")
/**
* Include the 'web' and 'actuator' starters as a vehicle to inspect the cache metrics. The focal point of the
* 'caching' subproject is caching *not* web stuff.
*/
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
}
application {
mainClass.set("dgroomes.spring_playground.caching.Main")
}