-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaven-publish.gradle
96 lines (81 loc) · 3.1 KB
/
maven-publish.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
85
86
87
88
89
90
91
92
93
94
95
96
// see: http://central.sonatype.org/pages/gradle.html
apply plugin: "signing"
def isReleaseBuild() {
return !version.contains("-SNAPSHOT")
}
def getReleaseRepositoryUrl() {
return hasProperty('MVN_RELEASE_REPO') ? MVN_RELEASE_REPO
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
def getSnapshotRepositoryUrl() {
return hasProperty("MVN_SNAPSHOT_REPO") ? MVN_SNAPSHOT_REPO
: "https://oss.sonatype.org/content/repositories/snapshots/"
}
def getRepositoryUsername() {
return hasProperty('MVN_USERNAME') ? MVN_USERNAME : ""
}
def getRepositoryPassword() {
return hasProperty('MVN_PASSWORD') ? MVN_PASSWORD : ""
}
def getProxyHost() {
return hasProperty('MVN_PROXY_HOST') ? MVN_PROXY_HOST : null
}
def getProxyPort() {
return hasProperty('MVN_PROXY_PORT') ? MVN_PROXY_PORT.toInteger() : 0
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
def proxyHost = getProxyHost()
def proxyPort = getProxyPort()
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
if (proxyHost != null) {
proxy(host: proxyHost, port: proxyPort, type: "http")
}
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
if (proxyHost != null) {
proxy(host: proxyHost, port: proxyPort, type: "http")
}
}
}
}
}
[install.repositories.mavenInstaller, uploadArchives.repositories.mavenDeployer]*.pom*.whenConfigured { pom ->
pom.project {
name "${ext.name}"
description "NEC Mobile Backend Platform Java/Android SDK"
url "https://github.com/nec-baas/baas-client-android"
scm {
url "https://github.com/nec-baas/baas-client-android"
connection "scm:git:https://github.com/nec-baas/baas-client-android.git"
developerConnection "scm:git:https://github.com/nec-baas/baas-client-android.git"
}
licenses {
license {
name "Apache License, Version 2.0"
url "https://opensource.org/licenses/Apache-2.0"
distribution "repo"
comments "Copyright (c) 2013-2018, NEC Corporation."
}
}
developers {
developer {
id "nec"
organization = "NEC Corporation"
organizationUrl "http://jpn.nec.com"
}
}
}
}
signing {
required {
isReleaseBuild() && gradle.taskGraph.hasTask(":core:uploadArchives")
}
sign configurations.archives
}
}