-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
106 lines (93 loc) · 2.82 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
97
98
99
100
101
102
103
104
105
106
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:"+project."springboot.version")
/**
* classpath dependency for Docker
*/
classpath('se.transmode.gradle:gradle-docker:1.2')
}
}
plugins {
id "org.asciidoctor.convert" version '1.5.3'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
/**
* Plugin applied for Docker
*/
apply plugin: 'docker'
jar {
baseName = 'andservice-read-api'
version = '0.0.1'
dependsOn asciidoctor
from ("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}
sourceCompatibility = project."java.version"
targetCompatibility = project."java.version"
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/libs-snapshot' }
}
ext['spring-restdocs.version'] = '1.2.1.RELEASE'
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-actuator-docs')
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
compile('org.springframework.boot:spring-boot-starter-jersey')
compile('org.springframework.boot:spring-boot-starter-mail')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.mockito:mockito-core:'+project."mockito.version")
asciidoctor "org.springframework.restdocs:spring-restdocs-asciidoctor:${project.ext['spring-restdocs.version']}"
//Test Dependencies
testCompile('com.jayway.restassured:rest-assured:'+project.'restassured.version')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.restdocs:spring-restdocs-mockmvc')
testCompile('org.testng:testng:'+project.'testng.version')
}
ext {
snippetsDir = file('build/docs/generated-snippets')
}
test {
outputs.dir snippetsDir
useTestNG()
}
asciidoctor {
attributes 'snippets': snippetsDir
inputs.dir snippetsDir
outputDir "build/asciidoc"
dependsOn test
sourceDir 'src/main/resources/static/asciidoc'
}
/* Task to copy the Rest Docs file At bootRun*/
task copyRestDocs(type: Copy) {
dependsOn asciidoctor
from "${asciidoctor.outputDir}/html5"
into "${sourceSets.main.output.resourcesDir}/static/docs"
}
bootRun {
/* Lets you pick Spring Boot profile by system properties, e.g. gradle bootRun -Dspring.profiles.active=dev */
systemProperties = System.properties
dependsOn copyRestDocs
}
/**
* Task added to build Docker Image from Gradle
*/
task buildDocker(type: Docker, dependsOn: build) {
applicationName = 'springgradle'
tagVersion = '0.2'
dockerfile = file('src/main/docker/DockerFile')
doFirst {
copy {
from jar
into stageDir
}
}
}