Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish to Maven Central instead of Bintray #95

Merged
merged 1 commit into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ A small library that provides helper functions to work with [Mockito](https://gi

## Install

Mockito-Kotlin is available on JCenter.
For Gradle users, add the following to your `build.gradle`:
Mockito-Kotlin is available on Maven Central.
For Gradle users, add the following to your `build.gradle`, replacing `x.x.x` with the latest version:

```groovy
repositories {
jcenter()
mavenCentral()
}
dependencies {
testCompile "com.nhaarman:mockito-kotlin:x.x.x"
Expand Down
6 changes: 6 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To publish a release:

- Tag the commit on master: `git tag -a x.x.x -m x.x.x && git push --tags`
- Execute the release process: `./gradlew clean test uploadArchives -PisRelease=true`
- Head to https://oss.sonatype.org/#stagingRepositories to close and release the deployment.
- Don't forget to publish the tag on Github with release notes :)
3 changes: 0 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
plugins {
id "com.jfrog.bintray" version "1.7.1"
id 'com.github.ben-manes.versions' version '0.13.0'
}
apply plugin: 'maven'
apply plugin: 'maven-publish'

apply from: 'gradle/scripts/tagging.gradle'
91 changes: 59 additions & 32 deletions mockito-kotlin/publishing.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,11 @@
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
artifact javadocJar
artifact sourcesJar

groupId 'com.nhaarman'
artifactId 'mockito-kotlin'
version rootProject.ext.versionName
}
}
}
apply plugin: 'maven'
apply plugin: 'signing'

bintray {
user = hasProperty('bintray_user') ? bintray_user : System.getenv('BINTRAY_USER')
key = hasProperty('bintray_key') ? bintray_key : System.getenv('BINTRAY_KEY')
publications = ['MyPublication']
group = 'com.nhaarman'
version = rootProject.ext.versionName
def sonatypeUsername = hasProperty('sonatype_username') ? sonatype_username : System.getenv('SONATYPE_USERNAME')
def sonatypePassword = hasProperty('sonatype_password') ? sonatype_password : System.getenv('SONATYPE_PASSWORD')

pkg {
repo = 'maven'
name = "Mockito-Kotlin"
desc = "Using Mockito with Kotlin"

licenses = ['MIT']
vcsUrl = 'https://github.com/bintray/gradle-bintray-plugin.git'

version {
name = rootProject.ext.versionName
desc = 'Using Mockito with Kotlin'
vcsTag = rootProject.ext.versionName
}
}
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
Expand All @@ -41,4 +15,57 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}

artifacts {
archives jar

archives javadocJar
archives sourcesJar
}

signing {
sign configurations.archives
}

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

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
authentication(
userName: sonatypeUsername,
password: sonatypePassword
)
}

pom.project {
name 'Mockito-Kotlin'
packaging 'jar'
description 'Using Mockito with Kotlin.'
url 'https://github.com/nhaarman/mockito-kotlin'

scm {
url 'scm:[email protected]:nhaarman/mockito-kotlin.git'
connection 'scm:[email protected]:nhaarman/mockito-kotlin.git'
developerConnection 'scm:[email protected]:nhaarman/mockito-kotlin.git'
}

licenses {
license {
name 'MIT'
distribution 'repo'
}
}

developers {
developer {
id 'nhaarman'
name 'Niek Haarman'
}
}
}
}
}
}