-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
94 lines (83 loc) · 2.91 KB
/
build.gradle
File metadata and controls
94 lines (83 loc) · 2.91 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
92
93
94
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.5'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'com.example'
version = '0.1.0'
java {
// 手元JDKに依存せず 21 でビルドするよう固定
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2024.0.1"
}
}
configurations.configureEach {
// Logback/ブリッジを除外し、log4j2に統一
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
exclude group: 'ch.qos.logback', module: 'logback-classic'
exclude group: 'ch.qos.logback', module: 'logback-core'
exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
implementation 'org.springframework.cloud:spring-cloud-function-context'
implementation 'org.springframework.cloud:spring-cloud-function-adapter-aws'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.amazonaws:aws-lambda-java-core:1.2.3'
implementation 'com.amazonaws:aws-java-sdk-secretsmanager:1.12.783'
implementation 'com.amazonaws.secretsmanager:aws-secretsmanager-jdbc:2.0.2'
implementation 'org.postgresql:postgresql:42.7.6'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
// Datadog manual span/tagging用
implementation 'com.datadoghq:dd-trace-api:1.56.3'
implementation 'io.opentracing:opentracing-api:0.33.0'
implementation 'io.opentracing:opentracing-util:0.33.0'
}
// Lambda用: Bootのfat jarは無効化し、通常のjarを生成する
bootJar {
enabled = false
}
jar {
enabled = true
archiveClassifier = ''
manifest {
attributes(
'Main-Class': 'com.example.LambdaHandlerApplication',
'Start-Class': 'com.example.LambdaHandlerApplication'
)
}
}
// 依存コピー
tasks.register('copyRuntimeLibs', Copy) {
from configurations.runtimeClasspath
into "$buildDir/lib"
}
// lib/ 配下に本体jarと依存をまとめた ZIP を生成
tasks.register('lambdaZip', Zip) {
dependsOn('jar', 'copyRuntimeLibs')
from("$buildDir/libs") {
include("${project.name}-${project.version}.jar")
into('lib')
}
from("$buildDir/lib") {
into('lib')
}
archiveFileName = "${project.name}-${project.version}-lambda.zip"
destinationDirectory = layout.buildDirectory.dir('distributions')
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
}