Skip to content

Commit 5062451

Browse files
authored
Merge pull request #295 from intercom/jn/migrate-publishing
Migrate publishing to maven central
2 parents 4bd9a8b + 6e6435c commit 5062451

File tree

4 files changed

+75
-144
lines changed

4 files changed

+75
-144
lines changed

README.md

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,34 @@
1-
[![Circle CI](https://circleci.com/gh/intercom/intercom-java.png?style=badge)](https://circleci.com/gh/intercom/intercom-java)
2-
31
# intercom-java
42

5-
Java bindings for the [Intercom API](https://api.intercom.io/docs)
3+
[![Circle CI](https://circleci.com/gh/intercom/intercom-java.svg?style=shield)](https://circleci.com/gh/intercom/intercom-java)
4+
[![Maven Central](https://img.shields.io/maven-central/v/io.intercom/intercom-java.svg?label=Maven%20Central)](https://search.maven.org/artifact/io.intercom/intercom-java)
5+
![Intercom API Version](https://img.shields.io/badge/Intercom%20API%20Version-1.3-blue)
66

7-
- [Installation](#add-a-dependency)
8-
- [Resources](#resources)
9-
- [Authorization](#authorization)
10-
- [Usage](#usage)
11-
- [Idioms](#idioms)
12-
- [Configuration](#configuration)
7+
Java bindings for the [Intercom API](https://api.intercom.io/docs)
138

9+
## Project Updates
1410

15-
## Add a dependency
11+
### Retirement of Bintray/JCenter
1612

17-
[ ![Download](https://api.bintray.com/packages/intercom/intercom-maven/intercom-java/images/download.svg) ](https://bintray.com/intercom/intercom-maven/intercom-java/_latestVersion)
13+
This project was previously publishing releases to JCenter, which is being retired by JFrog on May 1st 2021.
1814

19-
The distribution is hosted on [bintray](https://bintray.com/intercom/intercom-maven/intercom-java/view).
20-
To use the client, you can add the jcenter repository to your dependencies.
15+
To allow continued access to past versions, we've migrated them to Maven Central.
2116

22-
### Maven
17+
- [Installation](#add-a-dependency)
18+
- [Resources](#resources)
19+
- [Authorization](#authorization)
20+
- [Usage](#usage)
21+
- [Idioms](#idioms)
22+
- [Configuration](#configuration)
2323

24+
## Add a dependency
2425

25-
Add jcenter to your repositories in `pom.xml` or `settings.xml`:
26+
The distribution is hosted on [mavenCentral](https://search.maven.org/artifact/io.intercom/intercom-java).
27+
To use the client, you can add the mavenCentral repository to your dependencies.
2628

27-
```xml
28-
<repositories>
29-
<repository>
30-
<id>jcenter</id>
31-
<url>https://jcenter.bintray.com</url>
32-
</repository>
33-
</repositories>
34-
```
29+
### Maven
3530

36-
and add the project declaration to your `pom.xml`:
31+
Add the project declaration to your `pom.xml`:
3732

3833
```xml
3934
<dependency>
@@ -45,28 +40,28 @@ and add the project declaration to your `pom.xml`:
4540

4641
### Gradle
4742

48-
Add jcenter to your `repositories` block:
43+
Add mavenCentral to your `repositories` block:
4944

5045
```groovy
5146
repositories {
52-
jcenter()
47+
mavenCentral()
5348
}
5449
```
5550

5651
and add the project to the `dependencies` block in your `build.gradle`:
5752

5853
```groovy
5954
dependencies {
60-
compile 'io.intercom:intercom-java:2.8.1'
55+
implementation 'io.intercom:intercom-java:2.8.1'
6156
}
6257
```
6358

6459
### SBT
6560

66-
Add jcenter to your `resolvers` in your `build.sbt`:
61+
Add mavenCentral to your `resolvers` in your `build.sbt`:
6762

6863
```scala
69-
resolvers += "jcenter" at "https://jcenter.bintray.com"
64+
resolvers += "mavenCentral" at "https://repo1.maven.org/maven2"
7065
```
7166

7267
and add the project to your `libraryDependencies` in your `build.sbt`:
@@ -75,7 +70,6 @@ and add the project to your `libraryDependencies` in your `build.sbt`:
7570
libraryDependencies += "io.intercom" % "intercom-java" % "2.8.1"
7671
```
7772

78-
7973
## Resources
8074

8175
Resources this API supports:
@@ -90,10 +84,8 @@ Resources this API supports:
9084
- [Segments](#segments)
9185
- [Notes](#notes)
9286
- [Conversations](#conversations)
93-
- [Counts](#counts)
9487
- [Webhooks](#webhooks)
95-
96-
88+
- [Counts](#counts)
9789

9890
## Authorization
9991

@@ -103,8 +95,8 @@ Resources this API supports:
10395
# With an OAuth or Access token:
10496
Intercom.setToken("da39a3ee5e6b4b0d3255bfef95601890afd80709");
10597
```
106-
If you are building a third party application you can get your OAuth token by [setting-up-oauth](https://developers.intercom.io/page/setting-up-oauth) for Intercom.
10798

99+
If you are building a third party application you can get your OAuth token by [setting-up-oauth](https://developers.intercom.io/page/setting-up-oauth) for Intercom.
108100

109101
## Usage
110102

@@ -250,6 +242,7 @@ User converted = Contact.convert(contact, user);
250242
```
251243

252244
### Visitors
245+
253246
```java
254247
// Find visitor by ID
255248
Visitor visitor = Visitor.findByID("5b69565fa737210d1c2127f1");
@@ -348,7 +341,6 @@ Admin admin = Admin.find("123456");
348341
Admin admin = Admin.setAwayMode("123456", true, true);
349342
```
350343

351-
352344
### Events
353345

354346
```java
@@ -768,13 +760,12 @@ of IntercomException will be thrown. The exception will have Error objects
768760

769761
The API throws the following runtime exceptions -
770762

771-
- AuthorizationException: for a 401 or 403 response
772-
- InvalidException: for a 422 response or a local validation failure
773-
- RateLimitException: for a 429 rate limit exceeded response
774-
- ClientException: for a general 4xx response
775-
- ServerException: for a 500 or 503 response
776-
- IntercomException: general exception
777-
763+
- AuthorizationException: for a 401 or 403 response
764+
- InvalidException: for a 422 response or a local validation failure
765+
- RateLimitException: for a 429 rate limit exceeded response
766+
- ClientException: for a general 4xx response
767+
- ServerException: for a 500 or 503 response
768+
- IntercomException: general exception
778769

779770
## Configuration
780771

@@ -804,19 +795,18 @@ public class OkHttpSupplier implements HttpConnectorSupplier {
804795

805796
and hand a supplier to the Intercom object -
806797

807-
```
798+
```java
808799
final OkHttpClient client = new OkHttpClient();
809800
final OkUrlFactory factory = new OkUrlFactory(client);
810801
final OkHttpSupplier supplier = new OkHttpSupplier(factory);
811802
Intercom.setHttpConnectorSupplier(supplier);
812-
```
803+
```
813804

814805
#### Timeouts
815806

816807
The default connection and request timeouts can be set in milliseconds using the
817808
`Intercom.setConnectionTimeout` and `Intercom.setRequestTimeout` methods.
818809

819-
820810
### Target API Server
821811

822812
The base URI to target can be changed for testing purposes

build.gradle

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,10 @@
1-
buildscript {
2-
repositories {
3-
jcenter()
4-
mavenCentral()
5-
}
6-
//noinspection GroovyAssignabilityCheck
7-
dependencies {
8-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+'
9-
classpath 'org.ajoberstar:grgit:1.9.3'
10-
}
11-
}
12-
131
plugins {
14-
id 'signing'
15-
}
16-
17-
allprojects {
18-
apply plugin: 'idea'
2+
id 'idea'
3+
id 'signing'
194
}
205

216
subprojects {
22-
23-
buildscript {
24-
repositories {
25-
jcenter()
26-
mavenCentral()
27-
}
28-
//noinspection GroovyAssignabilityCheck
29-
dependencies {
30-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+'
31-
classpath 'org.ajoberstar:grgit:1.9.3'
32-
}
33-
}
34-
357
repositories {
36-
jcenter()
378
mavenCentral()
389
}
3910

@@ -46,7 +17,7 @@ subprojects {
4617
apply plugin: 'maven'
4718
apply plugin: 'maven-publish'
4819
apply plugin: 'java'
49-
apply plugin: 'com.jfrog.bintray'
20+
apply plugin: 'signing'
5021

5122
sourceCompatibility = 1.7
5223
targetCompatibility = 1.7
@@ -65,6 +36,6 @@ subprojects {
6536
}
6637
}
6738

68-
task wrapper(type: Wrapper) {
39+
wrapper {
6940
gradleVersion = '4.9'
7041
}

init.gradle

Lines changed: 0 additions & 14 deletions
This file was deleted.

intercom-java/build.gradle

Lines changed: 36 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import org.ajoberstar.grgit.Grgit
21
import java.text.SimpleDateFormat
32

43
final publicationVersion = new Version(version)
@@ -7,8 +6,11 @@ def rawVersion = version
76
group = 'io.intercom'
87
version = publicationVersion
98
status = version.status
10-
ext.publish = true
119

10+
ext {
11+
mvnUser = System.getenv('MVN_REPO_USER') ?: "dev"
12+
mvnPass = System.getenv('MVN_REPO_PASS') ?: "dev"
13+
}
1214

1315
task sourcesJar(type: Jar, dependsOn: classes) {
1416
classifier = 'sources'
@@ -40,65 +42,47 @@ publishing {
4042
}
4143
}
4244

43-
44-
bintray {
45-
// gradle apslodes if the bintray* props aren't found and we never run this task in circle
46-
if (System.getenv('release') != null) {
47-
user = System.getenv('BINTRAY_USER')
48-
key = System.getenv('BINTRAY_KEY')
49-
}
50-
publications = ['mavenJava']
51-
dryRun = false
52-
publish = project.publish
53-
pkg {
54-
repo = 'intercom-maven'
55-
userOrg = 'intercom'
56-
name = 'intercom-java'
57-
desc = 'Java bindings for the Intercom API'
58-
websiteUrl = 'https://github.com/intercom/intercom-java'
59-
issueTrackerUrl = 'https://github.com/intercom/intercom-java/issues'
60-
vcsUrl = 'https://github.com/intercom/intercom-java.git'
61-
licenses = ['Apache-2.0']
62-
labels = ['intercom', 'java', 'api']
63-
publicDownloadNumbers = true
64-
//noinspection GroovyAssignabilityCheck
65-
version {
66-
name = publicationVersion
67-
vcsTag = publicationVersion
68-
}
69-
}
70-
}
71-
7245
signing {
73-
String keyId = System.getenv('keyId');
74-
String gpgPassword = System.getenv('gpgPassword');
75-
if (project.hasProperty('signing.keyId') != null && gpgPassword != null && project.hasProperty('signing.secretKeyRingFile')) {
46+
if (project.hasProperty('signing.keyId') && project.hasProperty('signing.secretKeyRingFile')) {
7647
sign configurations.archives
7748
}
7849
}
7950

80-
ext.repo = Grgit.open(project.file('..'))
81-
82-
task printVersion << {
83-
println "publication version: ${publicationVersion}"
84-
println "raw version: ${rawVersion}"
85-
}
86-
87-
task tagRelease << {
88-
repo.tag.add {
89-
name = publicationVersion
90-
message = "Release of ${rawVersion}"
51+
task printVersion {
52+
doLast {
53+
println "publication version: ${publicationVersion}"
54+
println "raw version: ${rawVersion}"
9155
}
92-
repo.push(tags: true)
9356
}
9457

95-
/*
96-
export release=1 && gradle publishRelease
97-
*/
98-
task publishRelease(dependsOn: ['clean', 'tagRelease', 'bintrayUpload'])
99-
tagRelease.mustRunAfter clean
100-
bintrayUpload.mustRunAfter tagRelease
58+
uploadArchives {
59+
repositories.mavenDeployer {
60+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
61+
62+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
63+
authentication(userName: mvnUser, password: mvnPass)
64+
}
65+
66+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
67+
authentication(userName: mvnUser, password: mvnPass)
68+
}
10169

70+
pom.project {
71+
name 'intercom-java'
72+
artifactId 'intercom-java'
73+
packaging 'jar'
74+
description 'Java bindings for the Intercom API'
75+
url 'https://github.com/intercom/intercom-java'
76+
77+
licenses {
78+
license {
79+
name 'The Apache License, Version 2.0'
80+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
81+
}
82+
}
83+
}
84+
}
85+
}
10286

10387
/**
10488
* A version object for use in the publication and tagging tasks.

0 commit comments

Comments
 (0)