-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
128 lines (107 loc) · 3.17 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
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'findbugs'
group = 'com.unicodecollective'
version = '0.1.0'
sourceCompatibility = '1.6'
repositories {
mavenCentral()
}
dependencies {
compile 'log4j:log4j:1.2.16',
'joda-time:joda-time:2.1',
'com.google.guava:guava:11.0.2',
'commons-lang:commons-lang:2.6',
'org.sonatype.sisu.inject:cglib:2.2.2' // Test cglib code generation vs proxy usage
testCompile 'junit:junit:4.10',
'org.mockito:mockito-all:1.9.0'
}
jar {
dependsOn test
from 'LICENSE'
}
// custom tasks for creating source jar
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
from 'LICENSE'
}
// custom tasks for creating javadoc jar
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
from 'LICENSE'
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
signing {
sign configurations.archives
}
/* This blog explains how to get the deployable into Sonatype from Gradle:
http://jedicoder.blogspot.co.uk/2011/11/automated-gradle-project-deployment-to.html
In addition, it is necessary to provide source and javadoc artifacts.
'uploadArtifacts' will push the artifact into sonatype. Below is a description
of how to release it from there:
https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-8a.ReleaseIt
*/
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment {
MavenDeployment deployment -> signPom(deployment)
}
def sonatypeRepoUrl = version.endsWith('SNAPSHOT') ?
"https://oss.sonatype.org/content/repositories/snapshots/"
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
repository(url: sonatypeRepoUrl) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'amsterdam'
packaging 'jar'
description 'A Java throughput management library.'
url 'https://github.com/unicode-collective-london/amsterdam'
scm {
url 'scm:[email protected]:unicode-collective-london/amsterdam.git'
connection 'scm:[email protected]:unicode-collective-london/amsterdam.git'
developerConnection 'scm:[email protected]:unicode-collective-london/amsterdam.git'
}
licenses {
license {
name 'MIT License'
url 'http://www.opensource.org/licenses/MIT'
distribution 'repo'
}
}
developers {
developer {
id 'martindow'
name 'Martin Dow'
}
developer {
id 'paddycakes'
name 'Patrick Gallagher'
}
}
}
//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())
}
}
}
}