-
-
Notifications
You must be signed in to change notification settings - Fork 328
/
gradle-mvn-push.gradle
118 lines (108 loc) 路 3.49 KB
/
gradle-mvn-push.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.jetbrains.dokka'
group = GROUP
version = VERSION_NAME
def dokka = tasks['dokkaJavadoc']
dokkaJavadoc {
dokkaSourceSets {
configureEach {
includeNonPublic.set(false)
reportUndocumented.set(true)
skipEmptyPackages.set(true)
perPackageOption {
matchingRegex.set(".*\\.internal.*")
suppress.set(true)
}
}
}
}
task javadocJar(type: Jar, dependsOn: dokka) {
archiveClassifier.set('javadoc')
from dokka.outputDirectory
}
task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}
artifacts {
archives javadocJar
archives sourcesJar
}
afterEvaluate {
publishing {
repositories {
maven {
name "snapshot"
url = "https://oss.sonatype.org/content/repositories/snapshots"
credentials {
username = findProperty("NEXUS_USERNAME")
password = findProperty("NEXUS_PASSWORD")
}
}
maven {
name "staging"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
username = findProperty("NEXUS_USERNAME")
password = findProperty("NEXUS_PASSWORD")
}
}
}
publications {
release(MavenPublication) {
from components.release
artifact javadocJar
artifact sourcesJar
artifactId = project.name
pom {
name = POM_REPO_NAME
description = POM_DESCRIPTION
url = POM_URL
licenses {
license {
name = POM_LICENSE_NAME
url = POM_LICENSE_URL
}
}
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_CONNECTION
url = POM_URL
}
developers {
developer {
id = 'cortinico'
name = 'Nicola Corti'
email = 'corti.nico@gmail.com'
}
developer {
id = 'vbuberen'
name = 'Volodymyr Buberenko'
email = 'v.buberenko@gmail.com'
}
developer {
id = 'olivierperez'
name = 'Olivier Perez'
email = 'olivier@olivierperez.fr'
}
developer {
id = 'michalsikora90'
name = 'Michal Sikora'
}
}
}
}
}
}
def signingKey = findProperty("SIGNING_KEY")
def signingPwd = findProperty("SIGNING_PWD")
if (signingKey && signingPwd) {
signing {
useInMemoryPgpKeys(signingKey, signingPwd)
sign publishing.publications.release
}
} else {
logger.info("Signing Disable as the PGP key was not found")
}
}