-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
88 lines (75 loc) · 2.23 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:3.2.5")
}
}
plugins {
id 'java'
id 'com.palantir.docker' version '0.35.0'
id 'org.springframework.boot' version '3.2.5'
}
group='kingstonduo'
version='4.2'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.palantir.docker'
jar {
archivesBaseName='state-manager-service'
}
repositories {
mavenCentral()
}
sourceCompatibility = '21'
targetCompatibility = '21'
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.apache.commons:commons-compress:1.26.0'
implementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.data:spring-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.mockito:mockito-core'
testImplementation('org.mockito:mockito-junit-jupiter:3.12.4')
testImplementation 'org.springframework:spring-test:5.2.25.RELEASE'
}
springBoot {
mainClass = "org.kpmp.Application"
}
task unpack(type: Copy) {
dependsOn bootJar
from(zipTree(tasks.bootJar.outputs.files.singleFile))
into("build/dependency")
}
def getCurrentGitBranch() {
if (project.hasProperty('tag')) {
def tagValue = project.property('tag')
return tagValue
} else {
def gitBranch = "Unknown branch"
try {
def workingDir = new File("${project.projectDir}")
def result = 'git rev-parse --abbrev-ref HEAD'.execute(null, workingDir)
result.waitFor()
if (result.exitValue() == 0) {
gitBranch = result.text.trim()
}
} catch (e) {
}
if (gitBranch == "develop" || gitBranch == "master"){
return project.version
}else{
return gitBranch
}
}
}
docker {
name "kingstonduo/state-manager-service:" + getCurrentGitBranch()
copySpec.from(tasks.unpack.outputs).into("dependency")
buildArgs(['DEPENDENCY': "dependency"])
}