-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle
209 lines (173 loc) · 6.07 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
* Copyright © 2017 IBM Corp. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'https://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'io.spring.gradle:propdeps-plugin:0.0.9.RELEASE'
}
}
plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'io.codearte.nexus-staging' version '0.21.2'
}
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'signing'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
import org.apache.tools.ant.filters.*
archivesBaseName = 'watson-spring-boot-starter'
description = 'Spring Boot Starter for the IBM Watson Services'
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
shadowJar {
classifier = 'jar-with-dependencies'
}
artifacts {
archives sourcesJar
archives javadocJar
archives shadowJar
}
project.tasks.assemble.dependsOn project.tasks.shadowJar
checkstyle {
configFile = rootProject.file('checkstyle.xml')
ignoreFailures = false
}
checkstyleMain {
ignoreFailures = false
}
checkstyleTest {
ignoreFailures = false
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/libs-release' }
maven { url 'https://dl.bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo' }
}
processResources {
filter ReplaceTokens, tokens: [
'pom.version': project.version,
'build.date' : getDate()
]
}
dependencies {
// Watson Java SDK
compile group: 'com.ibm.watson', name: 'ibm-watson', version: watsonVersion
// Spring
compile group: 'org.springframework', name: 'spring-core', version: springVersion
compile group: 'org.springframework', name: 'spring-context', version: springVersion
compile group: 'org.springframework', name: 'spring-beans', version: springVersion
compile group: 'org.springframework.boot', name: 'spring-boot', version: springBootVersion
compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure', version: springBootVersion
optional group: 'org.springframework.boot', name: 'spring-boot-configuration-processor', version: springBootVersion
// testing
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile ('com.github.stefanbirkner:system-rules:1.19.0') {
exclude group:"junit" , module:"junit-dep"
}
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion
}
compileJava.dependsOn(processResources)
test {
testLogging {
events 'failed'
exceptionFormat 'full'
}
}
apply plugin: 'jacoco'
task codeCoverageReport(type: JacocoReport, dependsOn: test) {
getExecutionData().setFrom(fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec"))
getSourceDirectories().setFrom(files(sourceSets.main.allSource.srcDirs))
getClassDirectories().setFrom(files(sourceSets.main.output))
reports {
xml.enabled true
xml.destination file("${buildDir}/reports/jacoco/report.xml")
csv.enabled false
html.destination file("${buildDir}/reports/jacoco-html")
}
}
signing {
sign configurations.archives
}
signArchives {
onlyIf { Task task ->
def shouldExec = false
for (myArg in project.gradle.startParameter.taskRequests[0].args) {
if (myArg.toLowerCase().contains('signjars') || myArg.toLowerCase().contains('uploadarchives')) {
shouldExec = true
}
}
return shouldExec
}
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "http://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: System.env.CI_DEPLOY_USERNAME, password: System.env.CI_DEPLOY_PASSWORD)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/"){
authentication(userName: System.env.CI_DEPLOY_USERNAME, password: System.env.CI_DEPLOY_PASSWORD)
}
pom.project {
name 'IBM Watson Spring boot starter'
packaging 'jar'
description 'Spring Boot Starter for the IBM Watson Services'
url 'https://www.ibm.com/watson/developer'
scm {
connection 'scm:git:[email protected]:watson-developer-cloud/spring-boot-starter.git'
developerConnection 'scm:git:[email protected]:watson-developer-cloud/spring-boot-starter.git'
url 'https://github.com/watson-developer-cloud/spring-boot-starter'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'german'
name 'German Attanasio'
email '[email protected]'
}
}
}
}
}
}
def getDate() {
def date = new Date()
def formattedDate = date.format('yyyyMMddHHmmss')
return formattedDate
}
ext {
getDate = this.&getDate
}