forked from NrgXnat/container-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
344 lines (302 loc) · 11.2 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
import com.github.kongchen.swagger.docgen.mavenplugin.ApiSource
import com.github.zhurlik.SwaggerTask
import io.swagger.models.Contact
import io.swagger.models.Info
import io.swagger.models.License
buildscript {
ext {
vXnat = '1.7.6'
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url 'https://nrgxnat.jfrog.io/nrgxnat/libs-release'
name 'XNAT Release Repository'
}
maven {
url 'https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot'
name 'XNAT Snapshot Repository'
}
}
dependencies {
classpath "net.ltgt.gradle:gradle-apt-plugin:0.9"
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
classpath "gradle.plugin.com.github.zhurlik:gradle-swagger-plugin:0.2"
classpath group: 'io.swagger', name: 'swagger-core', version: '1.5.+'
classpath group: 'com.github.kongchen', name: 'swagger-maven-plugin', version: '3.1.+'
classpath "org.nrg.xdat:core:${vXnat}"
}
}
group 'org.nrg'
version '2.1.0'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: "net.ltgt.apt"
apply plugin: 'io.spring.dependency-management'
apply plugin: "com.github.zhurlik.swagger"
sourceCompatibility = 1.7
targetCompatibility = 1.7
def vMockito = '1.10.19'
def vJavassist = '3.21.0-GA'
def vAwaitility = '2.0.0'
repositories {
jcenter()
mavenCentral()
maven {
url 'https://nrgxnat.jfrog.io/nrgxnat/libs-release'
name 'XNAT Release Repository'
}
maven {
url 'https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot'
name 'XNAT Snapshot Repository'
}
maven {
url 'https://nrgxnat.jfrog.io/nrgxnat/ext-release'
name 'XNAT External Release Repository'
}
}
dependencyManagement {
imports {
mavenBom("org.nrg:parent:${vXnat}") {
bomProperties([
'mockito.version': vMockito,
'javassist.version': vJavassist
])
}
}
}
// I would prefer to use a floating version for docker client, like 8+, but they moved to java 8 and we are stuck on 7.
// Once we can move to java 8 I want to put this back to a floating version. That way we always get the latest updates.
def vDockerClient = '8.13.0'
def vJsonPath = '2.2.0'
def vAutoValue = '1.3'
def vPowerMock = '1.7.0'
def vGson = '2.8.1'
def vSwagger = '2.4.0'
def vJackson = dependencyManagement.importedProperties['jackson.version']
def vSpringSecurity = dependencyManagement.importedProperties['spring-security.version']
// Use this configuration to put dependencies into the fat jar
configurations {
compile.extendsFrom(compileAndInclude)
}
configurations.all {
resolutionStrategy.force "org.mockito:mockito-core:${vMockito}"
}
//// Possibly add annotation processor dependencies to IntelliJ
//idea {
// module {
// // With Gradle 3.4:
// scopes.PROVIDED.plus += [ configurations.apt ]
// scopes.TEST.plus += [ configurations.testApt ]
// // With older Gradle versions:
// // scopes.COMPILE.plus += [ configurations.apt ]
// // scopes.TEST.plus += [ configurations.testApt ]
// }
//}
dependencies {
compileAndInclude (group: 'com.spotify', name: 'docker-client', version: vDockerClient) {
exclude group: "ch.qos.logback"
exclude group: "com.fasterxml.jackson.core"
exclude group: "com.fasterxml.jackson.datatype"
}
compileAndInclude "com.jayway.jsonpath:json-path:${vJsonPath}"
compile ("org.nrg.xnat:web") {
transitive = false
}
compile "org.nrg:framework"
compile ("org.nrg.xdat:core") {
transitive = false
}
compile ("org.nrg.xnat:xnat-data-models") {
transitive = false
}
compile "org.nrg:prefs"
compile ("org.nrg:notify") {
exclude group: "cglib"
}
compile ("org.nrg:config") {
exclude group: "cglib"
}
compile ("org.nrg:automation") {
exclude group: "org.python"
exclude group: "cglib"
}
apt "org.nrg:framework"
compile ("cglib:cglib:2.2.2") {
exclude group: "asm"
}
compile "org.springframework:spring-beans"
compile "org.springframework:spring-context"
compile "org.springframework:spring-core"
compile "org.springframework:spring-tx"
compile "org.springframework:spring-web"
compile "org.springframework:spring-webmvc"
compile "io.springfox:springfox-swagger2:${vSwagger}"
compile "io.springfox:springfox-swagger-ui:${vSwagger}"
compile "org.hibernate:hibernate-core"
compile "com.fasterxml.jackson.core:jackson-annotations"
compile "com.fasterxml.jackson.core:jackson-core"
compile "com.fasterxml.jackson.core:jackson-databind"
compile "com.fasterxml.jackson.datatype:jackson-datatype-guava:${vJackson}"
compile "org.slf4j:slf4j-api"
compile "org.slf4j:slf4j-log4j12"
compile "org.projectlombok:lombok"
apt "org.projectlombok:lombok"
compile "commons-lang:commons-lang"
compile "javax.inject:javax.inject"
compile "javax.servlet:javax.servlet-api"
compileOnly "com.google.auto.value:auto-value:${vAutoValue}"
apt "com.google.auto.value:auto-value:${vAutoValue}"
compile ("turbine:turbine") {
transitive = false
}
compile ("org.apache.velocity:velocity") {
transitive = false
}
compile ("stratum:stratum") {
transitive = false
}
compile ("xalan:xalan") {
transitive = false
}
testCompile group: 'junit', name: 'junit'
testCompile "org.hamcrest:hamcrest-library"
testCompile "org.springframework:spring-test"
testCompile "org.springframework.security:spring-security-test:${vSpringSecurity}"
testCompile "org.springframework.security:spring-security-config"
testCompile "org.mockito:mockito-core"
testCompile "javax.servlet:javax.servlet-api"
testCompile "com.h2database:h2"
testCompile "org.springframework:spring-jdbc"
testCompile "org.springframework:spring-orm"
testCompile "com.google.code.gson:gson:${vGson}"
testCompile "org.json:json"
testCompile "org.apache.commons:commons-dbcp2"
testCompile "org.powermock:powermock-module-junit4:${vPowerMock}"
testCompile "org.powermock:powermock-api-mockito:${vPowerMock}"
testCompile "org.awaitility:awaitility:${vAwaitility}"
}
task unitTest( type: Test ) {
exclude '**/DockerControlApiTest.class', '**/*IntegrationTest.class'
}
task(type: SwaggerTask, 'swagger') {
// any dirs with classes
classesDirs = [
file("${buildDir}/classes/java/main")
// project(':your-project').sourceSets['main'].output.classesDir
]
apiSources = [
new ApiSource(
springmvc: true,
locations: ['org/nrg/containers/rest', 'org/nrg/xapi/rest'],
schemes: ['http', 'https'],
host: 'xnat.org',
basePath: '/xapi',
info: new Info(
title: 'Container Service API',
version: "${version}",
description: 'XAPI endpoints for the XNAT Container Service',
contact: new Contact(
email: '[email protected]',
name: 'Matt Kelsey'
),
license: new License(
url: 'https://github.com/NrgXnat/container-service/blob/master/LICENSE.md',
name: 'BSD 2-Clause'
)
),
swaggerDirectory: file("docs").path,
)
]
}
task fatJar(type: Jar) {
zip64 true
classifier = "fat"
from {
configurations.compileAndInclude.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
with jar
}
sourceSets.main.java {
srcDir 'generated'
exclude '*/AutoValue.java'
}
jar{
doLast {
throw new GradleException('ERROR: You should run fatJar instead of jar task for this plugin')
}
}
task sourceJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
artifact fatJar
pom.withXml {
def root = asNode()
root.appendNode('name', 'XNAT Container Service')
root.appendNode('description', 'XNAT plugin for launching and managing containers.')
root.appendNode('url', 'https://github.com/nrgxnat/container-service')
root.appendNode('inceptionYear', '2016')
def scm = root.appendNode('scm')
scm.appendNode('url', 'https://github.com/nrgxnat/container-service')
scm.appendNode('connection', 'scm:https://github.com/nrgxnat/container-service.git')
scm.appendNode('developerConnection', 'scm:[email protected]:nrgxnat/container-service')
def license = root.appendNode('licenses').appendNode('license')
license.appendNode('name', 'Simplified BSD 2-Clause License')
license.appendNode('url', 'http://xnat.org/about/license.php')
license.appendNode('distribution', 'repo')
def developers = root.appendNode('developers')
def flavin = developers.appendNode('developer')
flavin.appendNode('id', 'jflavin')
flavin.appendNode('name', 'John Flavin')
flavin.appendNode('email', '[email protected]')
def kelsey = developers.appendNode('developer')
kelsey.appendNode('id', 'kelseym')
kelsey.appendNode('name', 'Matt Kelsey')
kelsey.appendNode('email', '[email protected]')
def will = developers.appendNode('developer')
will.appendNode('id', 'hortonw')
will.appendNode('name', 'Will Horton')
will.appendNode('email', '[email protected]')
}
}
}
repositories {
maven {
credentials {
// These properties must be set in the ~/.gradle/gradle.properties file or passed on the Gradle command
// line in the form -PrepoUsername=foo -PrepoPassword=bar.
username propertyWithDefault('repoUsername', 'username')
password propertyWithDefault('repoPassword', 'password')
}
if (project.version.endsWith('-SNAPSHOT')) {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local"
} else {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local"
}
}
}
}
def propertyWithDefault(def String property, def Object value) {
hasProperty(property) ? getProperty(property) : value
}