-
Notifications
You must be signed in to change notification settings - Fork 35
/
build.gradle
106 lines (94 loc) · 3.08 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
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
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
install.dependsOn ':build'
defaultTasks 'clean', 'install'
sourceCompatibility = 1.7
version = '7.0.1'
group = 'com.createsend'
def localMavenRepo = 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.sun.jersey', name: 'jersey-client', version: '1.17.1'
compile group: 'com.sun.jersey', name: 'jersey-json', version: '1.17.1'
compile group: 'com.sun.jersey', 'name': 'jersey-core', version: '1.17.1'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.10.2'
compile group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.10.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.2'
compile group: 'commons-codec', name: 'commons-codec', version: '1.10'
compile group: 'commons-io', name: 'commons-io', version: '2.7'
}
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'src'
}
}
samples {
java {
srcDir 'samples'
}
}
}
task copyToLib(type: Copy) {
into "$buildDir/libs"
from configurations.runtime
}
task doc(type: Javadoc) {
source = sourceSets.main.allJava
title = "createsend-java $version"
classpath = sourceSets.main.compileClasspath
destinationDir = new File(new File(buildDir, 'doc'), version)
options.version = true
}
uploadArchives {
repositories {
mavenDeployer {
snapshotRepository(
url: 'https://oss.sonatype.org/content/repositories/snapshots',
id: 'sonatype-nexus-snapshots') {
authentication(getAuth('sonatype-nexus-snapshots'))
}
repository(
url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/',
id: 'sonatype-nexus-staging') {
authentication(getAuth('sonatype-nexus-staging'))
}
pom {
project {
name 'createsend-java'
description 'A Java library which implements the complete functionality of the Campaign Monitor API.'
url 'http://campaignmonitor.github.io/createsend-java/'
licenses {
license {
name 'The MIT License'
url 'https://raw.github.com/campaignmonitor/createsend-java/master/LICENSE'
distribution 'repo'
}
}
}
withXml { xml ->
new XmlParser().parse(new File("pom-include.xml")).children().each { kid -> xml.asNode().append(kid) }
}
}
}
}
}
task writePom << {
uploadArchives.repositories.mavenDeployer().getPom().writeTo("pom.xml")
}
def getAuth(repo_id) {
def m2_settings = new File("${System.getProperty('user.home')}/.m2/settings.xml")
if (m2_settings.exists()) {
def settings = new XmlSlurper().parse(m2_settings)
def repo = settings.servers.server.find { it.id.text() == repo_id }
if (repo != null) return [userName: repo.username.text(), password: repo.password.text()]
}
[:]
}