-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from appnexus/maven-central
support for publishing to Maven central
- Loading branch information
Showing
1 changed file
with
66 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
plugins { | ||
id 'java' | ||
id 'maven-publish' | ||
id 'maven' | ||
id 'org.unbroken-dome.test-sets' version '1.3.2' | ||
id "com.diffplug.gradle.spotless" version '3.3.0' | ||
id 'com.diffplug.gradle.spotless' version '3.3.0' | ||
id 'signing' | ||
id 'io.codearte.nexus-staging' version '0.9.0' | ||
} | ||
|
||
group = 'com.appnexus.grafana-client' | ||
|
||
description = """A simple java client for interacting with Grafana using a fluent interface""" | ||
version = '1.0.0' | ||
|
||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
|
||
repositories { | ||
jcenter() | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
ext { | ||
|
@@ -24,6 +27,9 @@ ext { | |
retrofitVersion = '2.2.0' | ||
} | ||
|
||
def ossrhUsername=project.properties['ossrhUsername'] ?: '' | ||
def ossrhPassword=project.properties['ossrhPassword'] ?: '' | ||
|
||
testSets { | ||
integrationTest { dirName = 'integration-test' } | ||
} | ||
|
@@ -41,25 +47,74 @@ dependencies { | |
} | ||
|
||
task sourceJar(type: Jar) { | ||
classifier = 'sources' | ||
from sourceSets.main.allJava | ||
} | ||
|
||
publishing { | ||
repositories { | ||
mavenLocal() | ||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
if (project.hasProperty('sign')) { | ||
signing { | ||
sign configurations.archives | ||
} | ||
} | ||
|
||
artifacts { | ||
archives javadocJar, sourceJar | ||
} | ||
|
||
uploadArchives { | ||
repositories { | ||
mavenDeployer { | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
|
||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { | ||
authentication(userName: ossrhUsername, password: ossrhPassword) | ||
} | ||
|
||
artifact sourceJar { | ||
classifier "sources" | ||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { | ||
authentication(userName: ossrhUsername, password: ossrhPassword) | ||
} | ||
|
||
pom.project { | ||
name project.name | ||
packaging 'jar' | ||
description project.description | ||
url 'https://github.com/appnexus/grafana-api-java-client' | ||
|
||
scm { | ||
connection 'scm:git:https://github.com/appnexus/grafana-api-java-client.git' | ||
developerConnection 'scm:git:[email protected]:appnexus/grafana-api-java-client.git' | ||
url 'https://github.com/appnexus/grafana-api-java-client.git' | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'The Apache License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'stevesample' | ||
name 'Steve Sample' | ||
email '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
nexusStaging { | ||
username = ossrhUsername | ||
password = ossrhPassword | ||
} | ||
|
||
spotless { | ||
java { | ||
googleJavaFormat() | ||
|