-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
150 lines (128 loc) · 4.36 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
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
}
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "net.ltgt.gradle:gradle-apt-plugin:0.7"
}
}
plugins {
id 'maven-publish'
}
// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "net.ltgt.apt"
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
apt 'org.immutables:value:2.5.6'
compileOnly 'org.immutables:value:2.5.6:annotations'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.6'
implementation 'org.asynchttpclient:async-http-client:2.6.0'
implementation 'com.google.guava:guava:27.0-jre'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-guava:2.9.5'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.4'
testImplementation("org.assertj:assertj-core:3.11.1")
testImplementation('org.mockito:mockito-core:2.23.0')
testImplementation group: 'junit', name: 'junit', version: '4.12'
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'com.bandwidth.sdk'
artifactId = 'numbers'
version = '0.4.0-SNAPSHOT'
from components.java
}
}
}
//Taken and changed from http://weibeld.net/java/publish-to-maven-central.html#deploy-to-ossrh
//To deploy, you need to define the following in your local ~/.gradle/gradle.properties file
//signing.keyId
//signing.password
//signing.secretKeyRingFile
//ossrhUsername
//ossrhPassword
//To deploy, run
//gradle uploadArchives
//If you don't remove the -SNAPSHOT, the deploy will only go to the staging repo
if (project.hasProperty("signing.keyId")) {
// Signing
apply plugin: 'signing'
signing {
sign configurations.archives
}
// Deploying
apply plugin: 'maven'
// Add Javadoc JAR and sources JAR to artifact
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
// Configure group ID, artifact ID, and version
group = "com.bandwidth.sdk"
archivesBaseName = "numbers"
version = "0.4.0-SNAPSHOT"
// Build, sign, and upload
uploadArchives {
repositories {
mavenDeployer {
// Sign POM
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// Destination
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword )
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword )
}
pom.project {
name 'Bandwidth Java Numbers'
packaging 'jar'
description 'Java SDK for Bandwidth Numbers'
url 'https://github.com/Bandwidth/numbers-java-sdk'
scm {
connection 'scm:git:git://github.com/Bandwidth/numbers-java-sdk.git'
developerConnection 'scm:git:ssh://github.com/Bandwidth/numbers-java-sdk.git'
url 'https://github.com/Bandwidth/numbers-java-sdk/tree/master'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'dx-bandwidth'
name 'DX-Bandwidth'
email 'dx@bandwidth.com'
organization 'bandwidth'
organizationUrl 'http://bandwidth.com'
}
}
}
}
}
}
}