forked from campaignmonitor/createsend-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
124 lines (111 loc) · 3.9 KB
/
build.gradle
File metadata and controls
124 lines (111 loc) · 3.9 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'eclipse'
apply plugin: 'idea'
java {
sourceCompatibility = JavaVersion.VERSION_1_9
}
version = '8.0.0-SNAPSHOT'
group = 'com.createsend'
def localMavenRepo = 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath
repositories {
mavenCentral()
}
dependencies {
implementation group: 'com.sun.jersey', name: 'jersey-client', version: '1.17.1'
implementation group: 'com.sun.jersey', name: 'jersey-json', version: '1.17.1'
implementation group: 'com.sun.jersey', 'name': 'jersey-core', version: '1.17.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.10.2'
implementation group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.10.2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.4.2'
implementation group: 'commons-codec', name: 'commons-codec', version: '1.10'
implementation 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 layout.buildDirectory.dir("libs")
from configurations.runtimeClasspath
}
task doc(type: Javadoc) {
source = sourceSets.main.allJava
title = "createsend-java $version"
classpath = sourceSets.main.compileClasspath
destinationDir = layout.buildDirectory.dir("doc/$version").get().asFile
options.version = true
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
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 {
def pomInclude = new XmlParser().parse(new File("pom-include.xml"))
pomInclude.children().each { child ->
asNode().append(child)
}
}
}
}
}
repositories {
maven {
name = "sonatypeSnapshots"
url = "https://oss.sonatype.org/content/repositories/snapshots"
credentials {
username = getAuth('sonatype-nexus-snapshots').userName ?: ""
password = getAuth('sonatype-nexus-snapshots').password ?: ""
}
}
maven {
name = "sonatypeStaging"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = getAuth('sonatype-nexus-staging').userName ?: ""
password = getAuth('sonatype-nexus-staging').password ?: ""
}
}
mavenLocal()
}
}
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()]
}
[:]
}
task writePom(dependsOn: generatePomFileForMavenJavaPublication) {
doLast {
copy {
from layout.buildDirectory.file("generated-pom.xml")
into projectDir
rename { String fileName -> "pom.xml" }
}
}
}