Skip to content

Commit

Permalink
Merge pull request #4 from Workday/maven-publishing
Browse files Browse the repository at this point in the history
Add configuration to publish to maven central
  • Loading branch information
ndtaylor committed Aug 4, 2015
2 parents 7f7082a + d45ddf9 commit b23b271
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 65 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,11 @@ Add the following lines to your `build.gradle`

```
repositories {
maven {
url "http://dl.bintray.com/workday/workday-oss"
}
mavenCentral()
}
dependencies {
compile 'com.workday:postman:0.9'
compile 'com.workday:postman:1.0'
}
```

Expand Down
17 changes: 16 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
VERSION_NAME=0.9
VERSION_NAME=1.0

GROUP=com.workday
POM_ARTIFACT_ID=postman
POM_NAME=Postman
POM_PACKAGING=jar

POM_URL=https://github.com/Workday/postman
POM_SCM_URL=https://github.com/Workday/postman
POM_SCM_CONNECTION=scm:[email protected]/Workday/postman.git
POM_SCM_DEV_CONNECTION=scm:[email protected]/Workday/postman.git

POM_LICENCE_NAME=The MIT License
POM_LICENCE_URL=http://opensource.org/licenses/MIT
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=ndtaylor
POM_DEVELOPER_NAME=Nathan Taylor

POM_DESCRIPTION=A java library that uses code generation to handle the details of implementing the Parcelable interface on Android.
42 changes: 0 additions & 42 deletions gradle/bintray-upload.gradle

This file was deleted.

109 changes: 109 additions & 0 deletions gradle/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* Copyright 2013 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'maven'
apply plugin: 'signing'

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}

def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
11 changes: 3 additions & 8 deletions postman/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
plugins {
id "com.jfrog.bintray" version "1.2"
}
apply plugin: 'java'
apply plugin: 'idea'
apply from: file('../gradle/bintray-upload.gradle')
apply from: file('../gradle/gradle-mvn-push.gradle')

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

repositories {
maven {
url "http://dl.bintray.com/workday/workday-oss"
}
mavenCentral()
}

Expand All @@ -27,6 +21,7 @@ sourceSets {
test.compileClasspath += configurations.provided
test.runtimeClasspath += configurations.provided
}
javadoc.classpath += configurations.provided

idea {
module{
Expand All @@ -39,5 +34,5 @@ dependencies {
compile 'com.google.guava:guava:18.0'
compile 'com.squareup:javawriter:2.5.0'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'com.workday:metajava:0.9'
compile 'com.workday:metajava:1.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* must take a single argument of type {@link Object}. Objects contained directly inside of lists or maps (keys or
* values in the case of maps) that are fields of this object will also be passed to the target method. The method
* should handle a null argument gracefully.
* <p/>
* <p>
* This can be useful if this object needs to recreate pointers back from the child to itself.
*
* @author nathan.taylor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

/**
* A utility class that assists with writing {@link Map}s to {@link Bundle}s.
* <p/>
* <p>
* This implementation can handle the following types of values and keys in maps:
* <pre>
* <ul>
* <li>{@link Integer}</li>
* <li>{@link String}</li>
* <li>{@link Parcelable}</li>
* </ul>
* </pre>
* <ul>
* <li>{@link Integer}</li>
* <li>{@link String}</li>
* <li>{@link Parcelable}</li>
* </ul>
*
* @author nathan.taylor
* @since 2014-5-12
Expand Down

0 comments on commit b23b271

Please sign in to comment.