-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
93 lines (78 loc) · 2.54 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
buildscript {
repositories {
mavenLocal()
maven { url ossimMavenProxy }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.17.RELEASE")
}
}
plugins {
id "com.github.ben-manes.versions" version "0.36.0"
id "org.sonarqube" version "3.1"
}
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: "idea"
apply plugin: "java"
apply plugin: "maven-publish"
project.ext {
gitBranch = getCurrentGitBranch(project)
gitBranch = gitBranch == "HEAD" ? branchName : gitBranch
buildVersionTag = gitBranch == "master" ? "RELEASE" : "SNAPSHOT"
}
project.version "${project.buildVersion}-${buildVersionTag}"
project.group groupName
ext {
dockerBuildDir = "${ rootProject.projectDir }/docker"
jarDestination = "${ project.projectDir }/build/libs/${ project.name }-${ project.version }.jar"
}
// Copy the built jar to the docker directory
task copyJarToDockerDir( type: Copy ) {
doFirst {
println "Copying ${ jarDestination } to ${ dockerBuildDir }"
}
from jarDestination
into dockerBuildDir
}
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
maven { url ossimMavenProxy }
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
applyMavenExclusions false
}
dependencies {
compile('org.springframework.boot:spring-boot-starter')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.cloud:spring-cloud-starter-aws')
compile('org.springframework.cloud:spring-cloud-starter-config')
compile("com.github.derjust:spring-data-dynamodb:${springDataDynamodbV}")
compile("com.amazonaws:aws-java-sdk-dynamodb:1.11.93")
compile('org.codehaus.groovy:groovy')
compile('org.codehaus.groovy:groovy-json')
compile('io.springfox:springfox-swagger-ui:2.0.1')
compile('io.springfox:springfox-swagger2:2.0.1')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
String getCurrentGitBranch(Project project) {
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) {
e.printStackTrace()
}
return gitBranch
}