-
Notifications
You must be signed in to change notification settings - Fork 0
/
maven-publish.gradle
85 lines (77 loc) · 2.87 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
apply plugin: "maven-publish"
apply plugin: "signing"
// Dokka is optional but recommended.
// Sonatype will not accept a published artifact without at least an empty Javadoc JAR.
task javadocsJar(type: Jar, dependsOn: "dokkaJavadoc") {
getArchiveClassifier().set("javadoc")
from dokkaJavadoc.outputDirectory
}
task sourcesJar(type: Jar) {
getArchiveClassifier().set("sources")
if (project.plugins.hasPlugin('com.android.application')
|| project.plugins.hasPlugin('com.android.library')) {
from android.sourceSets.main.kotlin.srcDirs
} else {
from sourceSets.main.allJava
}
}
afterEvaluate {
publishing {
// gets specific props defined per each module which breaks the need for multiple (per module) maven-publish files
def properties = project.ext.mavenPublishProperties
repositories {
maven {
name "SonatypeMavenCentral"
url properties.repository.url
credentials {
username properties.repository.username
password properties.repository.password
}
}
}
publications {
release(MavenPublication) {
// Only needed for non Android modules. Uncomment if it is needed.
// from components.java
groupId = properties.group
version = properties.version
artifactId = properties.artifactId
project.plugins.withId("com.android.library") {
artifact bundleReleaseAar
}
artifact sourcesJar
artifact javadocsJar
pom {
name = properties.name
description = properties.description
url = properties.url
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
organization {
name = 'Infinum Inc.'
url = 'https://infinum.com'
}
developers {
developer {
id = 'Infinum'
name = 'Infinum Inc.'
url = 'https://infinum.com'
}
}
scm {
connection.set(properties.scm.connection)
developerConnection.set(properties.scm.connection)
url.set(properties.scm.url)
}
}
signing {
sign publishing.publications.release
}
}
}
}
}