forked from Ecwid/consul-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
80 lines (67 loc) · 1.82 KB
/
build.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
apply plugin: "java"
apply plugin: "idea"
apply plugin: 'maven'
apply plugin: 'signing'
repositories {
mavenCentral()
}
dependencies {
compile "com.google.code.gson:gson:2.3"
compile "org.apache.httpcomponents:httpcore:4.2.5"
compile "org.apache.httpcomponents:httpclient:4.2.5"
testCompile "junit:junit:4.11"
}
// --------------------------------------------------------------
// Tasks for publishing into Maven Central
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
def getMavenSettingsCredentials = {
File mavenSettings = new File("/var/lib/jenkins/settings.xml")
if(mavenSettings.exists()) {
def xmlSlurper = new XmlSlurper()
def output = xmlSlurper.parse(mavenSettings)
return output."servers"."server"
} else {
return null
}
}
def getCredentials = {
def entries = getMavenSettingsCredentials()
if(entries) {
for (entry in entries) {
if ( entry."id".text() == "nexus.releases" )
return [username: entry.username.text(), password: entry.password.text()]
}
} else {
return ["username":"","password":""]
}
}
uploadArchives {
def creds = getCredentials()
repositories {
mavenDeployer {
repository(url: "http://nexus.internal.ibboost.com/content/repositories/releases/") {
authentication(userName: creds["username"], password: creds["password"])
}
pom.version = "1.1.11.1"
pom.artifactId = "consul-api"
pom.groupId = "com.ibboost.ecwid.consul"
}
}
}
// --------------------------------------------------------------
// Wrapper
task wrapper(type: Wrapper) {
gradleVersion = '2.11'
}