forked from sendgrid/java-http-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
156 lines (134 loc) · 3.61 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/**
* Commands:
* - gradle build
* - gradle test
* - gradle assemble
* - gradle uploadArchives
*
* To execute the 'uploadArchives' task, the following properties must be specified
* in an external 'gradle.properties' file:
* - sonatypeUsername
* - sonatypePassword
*/
apply plugin: 'java'
apply plugin: 'fatjar'
apply plugin: 'maven'
apply plugin: 'signing'
group = 'com.sendgrid'
version = '2.3.2'
ext.packaging = 'jar'
allprojects {
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
if (!hasProperty("sonatypeUsername")) {
ext.sonatypeUsername = null
ext.sonatypePassword = null
}
task wrapper(type: Wrapper) {
gradleVersion = '1.8'
}
buildscript {
dependencies {
classpath 'eu.appsatori:gradle-fatjar-plugin:0.1.2' // adds fatJar task
}
repositories {
mavenCentral()
}
}
dependencies {
compile 'org.apache.httpcomponents:httpcore:4.4.4'
compile 'org.apache.httpcomponents:httpclient:4.5.2'
compile 'org.mockito:mockito-core:1.10.19'
testCompile group: 'junit', name: 'junit-dep', version: '4.10'
}
repositories {
mavenCentral()
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
// adds 'with-dependencies' to the fatJar name
fatJar {
classifier 'jar'
baseName "sendgrid-java-http-client"
manifest {
attributes("Implementation-Title": "http", "Implementation-Version": version)
}
}
// copy fatJar to base project directory so they will be in git (and on github for download)
build << {
copy {
println "Copying ${fatJar.archiveName} to $projectDir/repo/com/sendgrid/$version"
from("$buildDir/libs/${fatJar.archiveName}")
into("$projectDir/repo/com/sendgrid/$version")
}
copy {
println "Copying ${fatJar.archiveName} to $projectDir/repo/com/sendgrid"
from("$buildDir/libs/${fatJar.archiveName}")
into("$projectDir/repo/com/sendgrid")
}
tasks.renameSendGridVersionJarToSendGridJar.execute()
}
task renameSendGridVersionJarToSendGridJar {
doLast {
file("$projectDir/repo/com/sendgrid/${fatJar.archiveName}").renameTo(file("$projectDir/repo/com/sendgrid/http-jar.jar"))
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'http'
packaging 'jar'
description 'A simple HTTP client'
url 'https://github.com/sendgrid/java-http-client'
scm {
url 'scm:git@github.com:sendgrid/java-http-client.git'
connection 'scm:git@github.com:sendgrid/java-http-client.git'
developerConnection 'scm:git@github.com:sendgrid/java-http-client.git'
}
licenses {
license {
name 'MIT License'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
}
}
developers {
developer {
id 'thinkingserious'
name 'Elmer Thomas'
}
}
}
}
}
}
artifacts {
archives fatJar
archives jar
archives javadocJar
archives sourcesJar
}