1- /*
2- * This build file was generated by the Gradle 'init' task.
3- *
4- * This generated file contains a sample Java project to get you started.
5- * For more details take a look at the Java Quickstart chapter in the Gradle
6- * user guide available at https://docs.gradle.org/3.3/userguide/tutorial_java_projects.html
7- */
8-
91buildscript {
102 repositories {
3+ mavenLocal()
114 mavenCentral()
125 }
136
@@ -23,6 +16,9 @@ buildscript {
2316 }
2417}
2518
19+ plugins {
20+ id ' maven-publish'
21+ }
2622
2723// Apply the java plugin to add support for Java
2824apply plugin : ' java'
@@ -40,11 +36,115 @@ targetCompatibility = 1.8
4036dependencies {
4137 apt ' org.immutables:value:2.5.6'
4238 compileOnly ' org.immutables:value:2.5.6:annotations'
43- compile ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.6'
44- compile ' org.asynchttpclient:async-http-client:2.6.0'
45- compile ' com.google.guava:guava:27.0-jre'
46- compile ' com.fasterxml.jackson.datatype:jackson-datatype-guava:2.9.5'
47- testCompile(' org.assertj:assertj-core:3.6.2' )
48- testCompile(' org.mockito:mockito-core:2.7.9' )
49- testCompile(' junit:junit:4.4' )
39+ implementation ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.6'
40+ implementation ' org.asynchttpclient:async-http-client:2.6.0'
41+ implementation ' com.google.guava:guava:27.0-jre'
42+ implementation ' com.fasterxml.jackson.datatype:jackson-datatype-guava:2.9.5'
43+ implementation ' com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.4'
44+ testImplementation(" org.assertj:assertj-core:3.11.1" )
45+ testImplementation(' org.mockito:mockito-core:2.23.0' )
46+ testImplementation group : ' junit' , name : ' junit' , version : ' 4.12'
47+ }
48+
49+ publishing {
50+ publications {
51+ maven(MavenPublication ) {
52+ groupId = ' com.bandwidth.sdk'
53+ artifactId = ' numbers'
54+ version = ' 0.1-SNAPSHOT'
55+ from components. java
56+ }
57+ }
58+ }
59+
60+ // Taken and changed from http://weibeld.net/java/publish-to-maven-central.html#deploy-to-ossrh
61+
62+ // To deploy, you need to define the following in your local ~/.gradle/gradle.properties file
63+ // signing.keyId
64+ // signing.password
65+ // signing.secretKeyRingFile
66+ // ossrhUsername
67+ // ossrhPassword
68+
69+ // To deploy, run
70+ // gradle uploadArchives
71+
72+ // If you don't remove the -SNAPSHOT, the deploy will only go to the staging repo
73+
74+ if (project. hasProperty(" signing.keyId" )) {
75+ // Signing
76+ apply plugin : ' signing'
77+ signing {
78+ sign configurations. archives
79+ }
80+
81+
82+ // Deploying
83+ apply plugin : ' maven'
84+
85+ // Add Javadoc JAR and sources JAR to artifact
86+ task javadocJar(type : Jar ) {
87+ classifier = ' javadoc'
88+ from javadoc
89+ }
90+ task sourcesJar(type : Jar ) {
91+ classifier = ' sources'
92+ from sourceSets. main. allSource
93+ }
94+ artifacts {
95+ archives javadocJar, sourcesJar
96+ }
97+
98+ // Configure group ID, artifact ID, and version
99+ group = " com.bandwidth.sdk"
100+ archivesBaseName = " numbers"
101+ version = " 0.1-SNAPSHOT"
102+
103+ // Build, sign, and upload
104+ uploadArchives {
105+ repositories {
106+ mavenDeployer {
107+
108+ // Sign POM
109+ beforeDeployment { MavenDeployment deployment -> signing. signPom(deployment) }
110+
111+ // Destination
112+ repository(url : " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ) {
113+ authentication(userName : ossrhUsername, password : ossrhPassword )
114+ }
115+ snapshotRepository(url : " https://oss.sonatype.org/content/repositories/snapshots/" ) {
116+ authentication(userName : ossrhUsername, password : ossrhPassword )
117+ }
118+ pom. project {
119+ name ' Bandwidth Java Numbers'
120+ packaging ' jar'
121+ description ' Java SDK for Bandwidth Numbers'
122+ url ' https://github.com/Bandwidth/numbers-java-sdk'
123+
124+ scm {
125+ connection ' scm:git:git://github.com/Bandwidth/numbers-java-sdk.git'
126+ developerConnection ' scm:git:ssh://github.com/Bandwidth/numbers-java-sdk.git'
127+ url ' https://github.com/Bandwidth/numbers-java-sdk/tree/master'
128+ }
129+
130+ licenses {
131+ license {
132+ name ' The Apache License, Version 2.0'
133+ url ' http://www.apache.org/licenses/LICENSE-2.0.txt'
134+ }
135+ }
136+
137+ developers {
138+ developer {
139+ id ' dx-bandwidth'
140+ name ' DX-Bandwidth'
141+ 142+ organization ' bandwidth'
143+ organizationUrl ' http://bandwidth.com'
144+ }
145+ }
146+ }
147+ }
148+ }
149+ }
50150}
0 commit comments