diff --git a/README.md b/README.md index e4422525..8a951f27 100644 --- a/README.md +++ b/README.md @@ -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" diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 00000000..49f0d01d --- /dev/null +++ b/RELEASING.md @@ -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 :) \ No newline at end of file diff --git a/build.gradle b/build.gradle index 06fdf0f1..dae319a6 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/mockito-kotlin/publishing.gradle b/mockito-kotlin/publishing.gradle index 4fa06572..3b08ab88 100644 --- a/mockito-kotlin/publishing.gradle +++ b/mockito-kotlin/publishing.gradle @@ -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' @@ -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:git@github.com:nhaarman/mockito-kotlin.git' + connection 'scm:git@github.com:nhaarman/mockito-kotlin.git' + developerConnection 'scm:git@github.com:nhaarman/mockito-kotlin.git' + } + + licenses { + license { + name 'MIT' + distribution 'repo' + } + } + + developers { + developer { + id 'nhaarman' + name 'Niek Haarman' + } + } + } + } + } } \ No newline at end of file