-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
96 lines (81 loc) · 2.28 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
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.1"
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'
eclipse {
project.natures 'org.eclipse.buildship.core.gradleprojectnature'
}
jar {
archivesBaseName='eridanus-data'
}
repositories {
mavenCentral()
}
processResources {
filesMatching('application.properties') {
expand(project.properties)
}
}
sourceCompatibility = '21'
targetCompatibility = '21'
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-mongodb")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.sun.mail:javax.mail:1.6.2")
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.eridanus.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/eridanus-data:" + getCurrentGitBranch()
copySpec.from(tasks.unpack.outputs).into("dependency")
buildArgs(['DEPENDENCY': "dependency"])
}