-
Notifications
You must be signed in to change notification settings - Fork 14
/
publish.gradle
60 lines (54 loc) · 1.44 KB
/
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
apply plugin: 'maven-publish'
def getBranch() {
def process = 'git branch --show-current'.execute()
process.waitFor()
return process.text.trim()
}
def getHash() {
def process = 'git rev-parse HEAD'.execute()
process.waitFor()
return process.text.trim()
}
java {
withJavadocJar()
withSourcesJar()
}
jar {
manifest {
attributes (
'Build-Jdk': "${System.properties['java.vendor']} ${System.properties['java.vm.version']}",
'Created-By': "Gradle ${gradle.gradleVersion}",
'Git-Branch': getBranch(),
'Git-Hash': getHash()
)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = group
artifactId = packageName
from components.java
}
}
repositories {
maven {
def releasesRepoUrl = "${artifactory_contextUrl}/libs-release-local"
def snapshotsRepoUrl = "${artifactory_contextUrl}/libs-snapshot-local"
if (version.endsWith('SNAPSHOT')) {
url = snapshotsRepoUrl
} else {
url = releasesRepoUrl
}
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
}
javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}