-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
181 lines (158 loc) · 5.01 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.1'
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'com.jfrog.bintray'
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'com.nfl.dm.util'
version = '0.1.9'
repositories {
mavenLocal()
mavenCentral()
}
def springVersion = "4.1.6.RELEASE"
dependencies {
compile("ma.glasnost.orika:orika-core:1.4.6")
compile("commons-beanutils:commons-beanutils:1.9.2")
compile group: 'org.slf4j', name: 'slf4j-simple', version : '1.7.12'
compile group: 'org.springframework', name: 'spring-context', version: springVersion
testCompile group: 'org.springframework', name: 'spring-test', version: springVersion
testCompile group: 'org.testng', name: 'testng', version: '6.9.4'
}
test {
useTestNG()
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
wrapper {
gradleVersion = '3.1'
}
uploadArchives {
repositories {
mavenDeployer {
pom.artifactId = 'audible'
repository(url: "http://nexus.dm.nfl.com/nexus/content/repositories/releases") {
authentication(userName: mavenUser, password: mavenPassword)
}
snapshotRepository(url: 'http://nexus.dm.nfl.com/nexus/content/repositories/snapshots') {
authentication(userName: mavenUser, password: mavenPassword)
}
}
}
}
publishing {
publications {
audible(MavenPublication) {
from components.java
groupId project.group
artifactId project.name
version version
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name project.name
description project.description
url 'https://github.com/nfl/audible'
scm {
url 'https://github.com/nfl/audible'
connection 'https://github.com/nfl/audible'
developerConnection 'https://github.com/nfl/audible'
}
licenses {
license {
name 'MIT'
url 'https://github.com/nfl/audible/blob/master/LICENSE'
distribution 'repo'
}
}
developers {
developer {
id 'chikim79'
name 'Chi Kim'
}
}
}
//Bug in maven-publish plugin changes scope to runtime instead of compile
//https://discuss.gradle.org/t/maven-publish-plugin-generated-pom-making-dependency-scope-runtime/7494
asNode().dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each { it.scope*.value = 'compile'}
}
}
}
}
bintray {
user = System.getenv('BINTRAY_USER') ?: project.findProperty('bintray.user')
key = System.getenv('BINTRAY_KEY') ?: project.findProperty('bintray.key')
publications = ['audible']
publish = true
pkg {
repo = 'maven'
name = 'audible'
userOrg = 'nfl'
licenses = ['MIT']
vcsUrl = 'https://github.com/nfl/audible'
version {
name = project.version
desc = project.description
released = new Date()
vcsTag = 'v'+ project.version
gpg {
sign = true
}
mavenCentralSync {
user = System.getenv('SONATYPE_USERNAME') ?: project.findProperty('sonatype.username')
password = System.getenv('SONATYPE_PASSWORD') ?: project.findProperty('sonatype.password')
}
}
}
}
// all publish tasks depend on the build task
tasks.withType(PublishToMavenRepository) {
dependsOn build
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
jar {
from "LICENSE"
manifest {
attributes(
"Specification-Title": project.name,
"Specification-Version": project.version,
"Implementation-Version": project.version,
)
}
}