Skip to content

Commit f165976

Browse files
authored
Merge pull request #95 from nhaarman/publish-to-maven-central
Publish to Maven Central instead of Bintray
2 parents 5878bbe + 8e083ad commit f165976

File tree

4 files changed

+68
-38
lines changed

4 files changed

+68
-38
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ A small library that provides helper functions to work with [Mockito](https://gi
55

66
## Install
77

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

1111
```groovy
1212
repositories {
13-
jcenter()
13+
mavenCentral()
1414
}
1515
dependencies {
1616
testCompile "com.nhaarman:mockito-kotlin:x.x.x"

RELEASING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
To publish a release:
2+
3+
- Tag the commit on master: `git tag -a x.x.x -m x.x.x && git push --tags`
4+
- Execute the release process: `./gradlew clean test uploadArchives -PisRelease=true`
5+
- Head to https://oss.sonatype.org/#stagingRepositories to close and release the deployment.
6+
- Don't forget to publish the tag on Github with release notes :)

build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
plugins {
2-
id "com.jfrog.bintray" version "1.7.1"
32
id 'com.github.ben-manes.versions' version '0.13.0'
43
}
5-
apply plugin: 'maven'
6-
apply plugin: 'maven-publish'
74

85
apply from: 'gradle/scripts/tagging.gradle'

mockito-kotlin/publishing.gradle

Lines changed: 59 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,11 @@
1-
publishing {
2-
publications {
3-
MyPublication(MavenPublication) {
4-
from components.java
5-
artifact javadocJar
6-
artifact sourcesJar
7-
8-
groupId 'com.nhaarman'
9-
artifactId 'mockito-kotlin'
10-
version rootProject.ext.versionName
11-
}
12-
}
13-
}
1+
apply plugin: 'maven'
2+
apply plugin: 'signing'
143

15-
bintray {
16-
user = hasProperty('bintray_user') ? bintray_user : System.getenv('BINTRAY_USER')
17-
key = hasProperty('bintray_key') ? bintray_key : System.getenv('BINTRAY_KEY')
18-
publications = ['MyPublication']
4+
group = 'com.nhaarman'
5+
version = rootProject.ext.versionName
6+
def sonatypeUsername = hasProperty('sonatype_username') ? sonatype_username : System.getenv('SONATYPE_USERNAME')
7+
def sonatypePassword = hasProperty('sonatype_password') ? sonatype_password : System.getenv('SONATYPE_PASSWORD')
198

20-
pkg {
21-
repo = 'maven'
22-
name = "Mockito-Kotlin"
23-
desc = "Using Mockito with Kotlin"
24-
25-
licenses = ['MIT']
26-
vcsUrl = 'https://github.com/bintray/gradle-bintray-plugin.git'
27-
28-
version {
29-
name = rootProject.ext.versionName
30-
desc = 'Using Mockito with Kotlin'
31-
vcsTag = rootProject.ext.versionName
32-
}
33-
}
34-
}
359

3610
task javadocJar(type: Jar, dependsOn: javadoc) {
3711
classifier = 'javadoc'
@@ -41,4 +15,57 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
4115
task sourcesJar(type: Jar) {
4216
from sourceSets.main.allSource
4317
classifier = 'sources'
18+
}
19+
20+
artifacts {
21+
archives jar
22+
23+
archives javadocJar
24+
archives sourcesJar
25+
}
26+
27+
signing {
28+
sign configurations.archives
29+
}
30+
31+
uploadArchives {
32+
repositories {
33+
mavenDeployer {
34+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
35+
36+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
37+
authentication(
38+
userName: sonatypeUsername,
39+
password: sonatypePassword
40+
)
41+
}
42+
43+
pom.project {
44+
name 'Mockito-Kotlin'
45+
packaging 'jar'
46+
description 'Using Mockito with Kotlin.'
47+
url 'https://github.com/nhaarman/mockito-kotlin'
48+
49+
scm {
50+
url 'scm:git@github.com:nhaarman/mockito-kotlin.git'
51+
connection 'scm:git@github.com:nhaarman/mockito-kotlin.git'
52+
developerConnection 'scm:git@github.com:nhaarman/mockito-kotlin.git'
53+
}
54+
55+
licenses {
56+
license {
57+
name 'MIT'
58+
distribution 'repo'
59+
}
60+
}
61+
62+
developers {
63+
developer {
64+
id 'nhaarman'
65+
name 'Niek Haarman'
66+
}
67+
}
68+
}
69+
}
70+
}
4471
}

0 commit comments

Comments
 (0)