Skip to content

Commit

Permalink
Merge pull request #3 from appnexus/maven-central
Browse files Browse the repository at this point in the history
support for publishing to Maven central
  • Loading branch information
Steve Sample authored Jul 19, 2017
2 parents e918ae6 + 9dcb282 commit ef76c59
Showing 1 changed file with 66 additions and 11 deletions.
77 changes: 66 additions & 11 deletions build.gradle
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 {
Expand All @@ -24,6 +27,9 @@ ext {
retrofitVersion = '2.2.0'
}

def ossrhUsername=project.properties['ossrhUsername'] ?: ''
def ossrhPassword=project.properties['ossrhPassword'] ?: ''

testSets {
integrationTest { dirName = 'integration-test' }
}
Expand All @@ -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:git@github.com: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 'steve.sample22@gmail.com'
}
}
}
}
}
}

nexusStaging {
username = ossrhUsername
password = ossrhPassword
}

spotless {
java {
googleJavaFormat()
Expand Down

0 comments on commit ef76c59

Please sign in to comment.