-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy.gradle
65 lines (54 loc) · 2.1 KB
/
deploy.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
apply from: 'build.gradle'
apply plugin: 'signing'
defaultTasks 'clean', 'test', 'install', 'uploadArchives'
signing {
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: project.version.endsWith("-SNAPSHOT") ?
'https://oss.sonatype.org/content/repositories/snapshots/' :
'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: "$sonatypeUsername", password: "$sonatypePassword")
}
pom.project {
name archivesBaseName
packaging 'jar'
description 'geo ip'
url 'https://github.com/codeborne/geoip'
scm {
url 'scm:[email protected]:codeborne/geoip.git'
connection 'scm:[email protected]:codeborne/geoip.git'
developerConnection 'scm:[email protected]:codeborne/geoip.git'
}
licenses {
license {
name 'MIT'
url 'https://opensource.org/licenses/MIT'
distribution 'repo'
}
}
developers {
developer {
id 'asolntsev'
name 'Andrei Solntsev'
}
}
}
//mess with the generated pom to set the 'packaging' tag
pom.withXml { XmlProvider xmlProvider ->
def xml = xmlProvider.asString()
def pomXml = new XmlParser().parse(new ByteArrayInputStream(xml.toString().bytes))
pomXml.version[0] + { packaging('jar') }
def newXml = new StringWriter()
def printer = new XmlNodePrinter(new PrintWriter(newXml))
printer.preserveWhitespace = true
printer.print(pomXml)
xml.setLength(0)
xml.append(newXml.toString())
}
}
}
}