-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpublishing.gradle
84 lines (72 loc) · 2.56 KB
/
publishing.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
publishing {
def sonatype_username = "${findProperty('sonatype_username') ?: System.getenv("sonatype_username")}"
def sonatype_password = "${findProperty('sonatype_password') ?: System.getenv("sonatype_password")}"
repositories {
maven {
name = "Sonatype"
setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = sonatype_username
password = sonatype_password
}
}
maven {
name = "SonatypeSnapshots"
setUrl("https://oss.sonatype.org/content/repositories/snapshots/")
credentials {
username = sonatype_username
password = sonatype_password
}
}
}
task sourcesJar(type: Jar) {
classifier = "sources"
from(sourceSets["main"].allSource)
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from(javadoc.destinationDir)
}
publications {
maven(MavenPublication) {
from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)
version = git.versionName()
groupId = "com.nhaarman"
pom {
name = "HttpMonads"
description = "HttpMonads introduces monad types for working with Http requests."
url = "https://github.com/nhaarman/HttpMonads"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "nhaarman"
name = "Niek Haarman"
}
}
scm {
connection = 'scm:git@github.com:nhaarman/HttpMonads.git'
developerConnection = 'scm:git@github.com:nhaarman/HttpMonads.git'
url = 'https://github.com/nhaarman/HttpMonads'
}
}
}
}
}
tasks.withType(PublishToMavenRepository) {
onlyIf {
git.versionName().contains("SNAPSHOT") && repository == publishing.repositories["SonatypeSnapshots"] ||
!git.versionName().contains("SNAPSHOT") && repository == publishing.repositories["Sonatype"]
}
}
signing {
if (findProperty("signing.keyId") != null) {
sign(publishing.publications["maven"])
}
}