-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.gradle
210 lines (182 loc) · 6.19 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
plugins {
id 'java'
id 'idea'
id 'jacoco'
id "io.spring.dependency-management" version "1.0.2.RELEASE"
id 'maven-publish'
id 'signing'
id 'nebula.optional-base' version '3.0.3'
id 'nebula.provided-base' version '3.0.3'
id "io.codearte.nexus-staging" version "0.8.0"
}
ext {
pomFile = file("${project.buildDir}/publications/maven/pom-default.xml")
isReleaseVersion = !(project.version =~ /-SNAPSHOT$/)
ossrhUser = project.hasProperty('sonatypeUsername') ? sonatypeUsername : System.getenv('sonatypeUsername')
ossrhPassword = project.hasProperty('sonatypePassword') ? sonatypePassword : System.getenv('sonatypePassword')
}
idea {
project {
jdkName = '1.8'
languageLevel = '1.8'
vcs = 'Git'
}
}
nexusStaging {
username = ossrhUser
password = ossrhPassword
}
tasks.withType(JavaCompile) {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencyManagement {
imports {
mavenBom 'io.spring.platform:platform-bom:Brussels-SR2'
}
}
dependencies {
compile("org.springframework.boot:spring-boot-autoconfigure")
compile("org.springframework.boot:spring-boot-starter-logging")
compileOnly('org.springframework.boot:spring-boot-configuration-processor')
compile("org.springframework:spring-webmvc")
compile('org.springframework:spring-aop')
compile('org.aspectj:aspectjweaver')
compile 'org.springframework.retry:spring-retry', optional
provided 'org.projectlombok:lombok'
compile 'org.apache.commons:commons-lang3:3.5'
compile 'net.javacrumbs.future-converter:future-converter-spring-java8:1.1.0'
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile('org.springframework.boot:spring-boot-starter-hateoas')
testCompile("com.fasterxml.jackson.datatype:jackson-datatype-jdk8")
testCompile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
testCompile('org.assertj:assertj-core:3.6.2')
}
tasks.withType(Jar) {
from(project.projectDir) {
include 'LICENSE'
into 'META-INF'
}
}
task sourceJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives jar
archives sourceJar
archives javadocJar
}
signing {
required { signatory != null && project.ext.isReleaseVersion }
sign configurations.archives
}
publishing {
repositories {
maven {
if (project.ext.isReleaseVersion) {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
} else {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
credentials {
username = ossrhUser
password = ossrhPassword
}
}
}
publications {
maven(MavenPublication) {
pom.withXml {
// fix maven-publish issue when all maven dependencies are placed into runtime scope
asNode().dependencies.dependency.findAll() {
it.scope.text() == 'runtime' && project.configurations.compile.dependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each { it.scope*.value = 'compile' }
asNode().children().last() + {
resolveStrategy = DELEGATE_FIRST
name "${project.name}"
description "${project.description}"
url 'https://github.com/polysantiago/spring-boot-rest-client'
inceptionYear 2017
licenses {
license {
name 'MIT License'
url 'http://www.opensource.org/licenses/mit-license.php'
distribution 'repo'
}
}
developers {
developer {
id 'polysantiago'
name 'Pablo Santiago'
email '[email protected]'
url 'https://github.com/polysantiago'
}
}
scm {
url 'https://github.com/polysantiago/spring-boot-rest-client'
connection 'scm:git:https://github.com/polysantiago/spring-boot-rest-client.git'
developerConnection 'scm:git:ssh://[email protected]:polysantiago/spring-boot-rest-client.git'
}
}
}
from components.java
artifact sourceJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
// Sign the pom.xml and artifacts.
if (signing.required) {
// Sign the artifacts.
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
if (matcher.find()) {
classifier = matcher.group(1)
} else {
classifier = null
}
extension = 'jar.asc'
}
}
}
}
if (signing.required) {
gpgPom(MavenPublication) {
def pomAscFile = signing.sign(project.ext.pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
extension = 'pom.asc'
}
}
}
}
}
publish.dependsOn check
model {
tasks.publishMavenPublicationToMavenLocal {
dependsOn(project.tasks.signArchives)
}
tasks.publishMavenPublicationToMavenRepository {
dependsOn(project.tasks.signArchives)
}
}
task install(dependsOn: publishToMavenLocal)
test {
testLogging {
exceptionFormat = 'full'
}
}