-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbuild.gradle
More file actions
170 lines (143 loc) · 4.78 KB
/
build.gradle
File metadata and controls
170 lines (143 loc) · 4.78 KB
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
buildscript {
repositories {
mavenCentral()
maven { url 'https://plugins.gradle.org/m2/' }
jcenter()
google()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'ch.raffael.pegdown-doclet:pegdown-doclet:1.2.1'
// Only add Spotless if running on Java 11+
// TODO: Remove this when we drop support for Java 8
if (JavaVersion.current() >= JavaVersion.VERSION_11) {
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.25.0'
}
}
}
plugins {
id "java"
id "signing"
id "maven-publish"
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'com.gocardless'
version = '8.2.0'
apply plugin: 'ch.raffael.pegdown-doclet'
// TODO: Remove this when we drop support for Java 8
// Conditionally apply Spotless plugin only on Java 11+
// (required because Spotless 6.x needs Java 11+ to load)
if (JavaVersion.current() >= JavaVersion.VERSION_11) {
apply plugin: 'com.diffplug.spotless'
}
repositories {
mavenCentral()
maven { url 'https://plugins.gradle.org/m2/' }
jcenter()
google()
maven {
url 'https://maven.google.com'
}
}
dependencies {
implementation("com.squareup.okhttp3:okhttp:4.9.1")
implementation 'com.google.code.gson:gson:2.8.7'
implementation("com.google.guava:guava:30.1.1-jre")
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'commons-codec:commons-codec:1.15'
implementation('com.github.rholder:guava-retrying:2.0.0') {
exclude group: 'com.google.guava', module: 'guava'
}
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.assertj:assertj-core:3.19.0'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.9.1'
}
javadoc {
options.memberLevel = JavadocMemberLevel.PUBLIC
options.noTimestamp = true
options.links = [
'http://docs.oracle.com/javase/8/docs/api/'
]
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from tasks.javadoc.destinationDir
archiveClassifier = 'javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier = 'sources'
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId 'com.gocardless'
artifactId 'gocardless-pro'
from components.java
artifacts = [jar, javadocJar, sourcesJar]
pom {
name.set('GoCardless Client')
packaging 'jar'
description.set('Client library for accessing the GoCardless API')
url.set('http://developer.gocardless.com/')
scm {
url.set('scm:git@github.com:gocardless/gocardless-pro-java.git')
connection.set('scm:git@github.com:gocardless/gocardless-pro-java.git')
developerConnection.set('scm:git@github.com:gocardless/gocardless-pro-java.git')
}
licenses {
license {
name.set('MIT')
url.set('http://www.opensource.org/licenses/mit-license.php')
distribution.set('repo')
}
}
developers {
developer {
name.set('GoCardless Ltd')
email.set('client-libraries@gocardless.com')
}
}
}
}
}
repositories {
maven {
name = "OSSRH"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
nexusPublishing {
repositories {
sonatype {
//only for users registered in Sonatype after 24 Feb 2021
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
// Only configure Spotless if it was applied (Java 11+)
if (JavaVersion.current() >= JavaVersion.VERSION_11) {
spotless {
java {
importOrder()
removeUnusedImports()
eclipse().configFile("format.xml")
}
}
}