Last active
January 15, 2018 08:17
-
-
Save weibeld/7af5d5509ae152c209257a494d071b08 to your computer and use it in GitHub Desktop.
Example build.gradle file for deploying project to Sonatype OSSRH
This file contains hidden or 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
// Building | |
apply plugin: 'java' | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
compile 'com.rabbitmq:amqp-client:5.1.0' | |
} | |
// Signing | |
apply plugin: 'signing' | |
signing { | |
sign configurations.archives | |
} | |
// Deploying | |
apply plugin: 'maven' | |
// Add Javadoc JAR and sources JAR to artifact | |
task javadocJar(type: Jar) { | |
classifier = 'javadoc' | |
from javadoc | |
} | |
task sourcesJar(type: Jar) { | |
classifier = 'sources' | |
from sourceSets.main.allSource | |
} | |
artifacts { | |
archives javadocJar, sourcesJar | |
} | |
// Configure group ID, artifact ID, and version | |
group = "net.weibeld.rabbitmq" | |
archivesBaseName = "rabbitmq-manager" | |
version = "0.0.1" | |
// Build, sign, and upload | |
uploadArchives { | |
repositories { | |
mavenDeployer { | |
// Sign POM | |
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | |
// Destination | |
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { | |
authentication(userName: ossrhUsername, password: ossrhPassword) | |
} | |
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { | |
authentication(userName: ossrhUsername, password: ossrhPassword) | |
} | |
// Add required metadata to POM | |
pom.project { | |
name 'RabbitMQ Manager' | |
packaging 'jar' | |
description 'Convenience class for facilitating some common RabbitMQ tasks.' | |
url 'https://github.com/weibeld/RabbitMQ-Manager' | |
scm { | |
connection 'scm:git:git://github.com/weibeld/RabbitMQ-Manager.git' | |
developerConnection 'scm:git:ssh://github.com/weibeld/RabbitMQ-Manager.git' | |
url 'http://github.com/weibeld/RabbitMQ-Manager/tree/master' | |
} | |
licenses { | |
license { | |
name 'The Apache License, Version 2.0' | |
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | |
} | |
} | |
developers { | |
developer { | |
id 'weibeld' | |
name 'Daniel Weibel' | |
email '[email protected]' | |
organization 'weibeld' | |
organizationUrl 'http://weibeld.net' | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains hidden or 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
signing.keyId=<PUBLIC-KEY-ID> | |
signing.password=<YOUR-KEY-PASSWORD> | |
signing.secretKeyRingFile=~/.gnupg/secring.gpg | |
ossrhUsername=<YOUR-OSSRH-USERNAME> | |
ossrhPassword=<YOUR-OSSRH-PASSWORD> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment