-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrelease.gradle
114 lines (101 loc) · 4.11 KB
/
release.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
apply plugin: 'maven-publish'
apply plugin: 'signing'
ext {
isReleaseVersion = !version.endsWith("SNAPSHOT")
}
if ( isReleaseVersion ) {
println 'using staging'
ext.mavenCentralUploadUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
} else {
println 'using snapshot'
ext.mavenCentralUploadUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
tasks.register('javadocJar', Jar) {
archiveClassifier = 'javadoc'
from javadoc
}
tasks.register('sourcesJar', Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
publishing {
publications {
requestCorrelationStarter(MavenPublication) {
from components.java
artifact javadocJar
artifact sourcesJar
pom {
name = 'spring-boot-starter-request-correlation'
description = 'A Spring Boot starter that can set correlation ids on outgoing requests.'
url = 'https://github.com/stevesaliman/spring-boot-starter-request-correlation'
packaging = 'jar'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'stevesaliman'
name = 'Steven C. Saliman'
email = '[email protected]'
}
developer {
id = 'jmnarloch'
name = 'Jakub Narloch'
email = '[email protected]'
}
}
scm {
connection = 'scm:https://[email protected]/stevesaliman/spring-boot-starter-request-correlation'
developerConnection = 'scm:[email protected]:stevesaliman/spring-boot-starter-request-correlation.git'
url = 'https://github.com/stevesaliman/spring-boot-starter-request-correlation'
}
}
}
}
repositories {
maven {
url = mavenCentralUploadUrl
// We only need to mess with credentials if we're publishing...
if ( gradle.startParameter.taskNames.contains("publish") ) {
println "\n\nWe have to upload some things in this build...\n"
if ( !project.hasProperty('mavenCentralUsername') ) {
throw new MissingPropertyException("No mavenCentralUsername was provided")
}
if ( !project.hasProperty('mavenCentralPassword') ) {
throw new MissingPropertyException("No mavenCentralPassword was provided")
}
credentials {
username mavenCentralUsername
password mavenCentralPassword
}
}
}
}
}
signing {
sign publishing.publications.requestCorrelationStarter
}
// When we're ready to go, there are a couple of things we'll need to do before we execute anything.
gradle.taskGraph.whenReady { taskGraph ->
// Only *require* signing if we are uploading a non snapshot version. If we
// do need to sign, make sure we've got the properties we need to do the
// signing.
tasks.withType(org.gradle.plugins.signing.Sign).all {
def required = (taskGraph.hasTask(":publish") && isReleaseVersion)
if ( required ) {
println "\n\nWe have to sign some things in this build...\n"
if ( !project.hasProperty('signing.keyId') ) {
throw new MissingPropertyException("No signing.keyId was provided")
}
if ( !project.hasProperty('signing.secretKeyRingFile') ) {
throw new MissingPropertyException("No signing.secretKeyRingFile was provided")
}
if ( !project.hasProperty('signing.password') ) {
throw new MissingPropertyException("No signing.password was provided")
}
}
}
}