-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
188 lines (155 loc) · 4.98 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
182
183
184
185
186
187
188
plugins {
id "com.github.spotbugs" version "4.6.1"
id 'org.asciidoctor.jvm.convert' version '3.1.0'
id 'java-library'
id 'signing'
id 'maven-publish'
id 'checkstyle'
}
repositories {
mavenCentral()
}
group = "com.github.therapi"
version = "0.5.1-SNAPSHOT"
def githubProjectName = "therapi-json-rpc"
def projectDescription = "JSON-RPC Microframework for Java"
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
def slf4jVersion = '1.7.30'
def jacksonVersion = '2.12.1'
def springVersion = '5.3.4'
compileOnly 'javax.servlet:javax.servlet-api:3.1.0'
// optional dependencies
compileOnly "org.springframework:spring-web:${springVersion}"
compileOnly "org.springframework:spring-webmvc:${springVersion}"
compileOnly "org.springframework:spring-aop:${springVersion}"
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
implementation 'com.google.code.findbugs:jsr305:3.0.0'
implementation 'com.google.guava:guava:21.0'
implementation 'org.apache.commons:commons-lang3:3.11'
implementation 'org.apache.commons:commons-text:1.9'
implementation 'aopalliance:aopalliance:1.0'
api "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
api "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
api "com.fasterxml.jackson.module:jackson-module-parameter-names:${jacksonVersion}"
api "com.fasterxml.jackson.module:jackson-module-jsonSchema:${jacksonVersion}"
implementation "com.github.therapi:therapi-runtime-javadoc:0.12.0"
testImplementation 'junit:junit:4.12'
testImplementation 'net.javacrumbs.json-unit:json-unit:1.28.2'
testImplementation "org.slf4j:slf4j-simple:${slf4jVersion}"
testImplementation "org.springframework:spring-aop:${springVersion}"
}
task sourceJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
}
def gitUrl = "[email protected]:dnault/${githubProjectName}.git";
def pomConfig = {
name "${group}:${project.name}"
description projectDescription
url "https://github.com/dnault/${githubProjectName}"
scm {
url "${gitUrl}"
connection "scm:git:${gitUrl}"
developerConnection "scm:git:${gitUrl}"
}
licenses {
license {
name 'Apache License 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name 'David Nault'
email '[email protected]'
organization 'dnault'
organizationUrl 'https://github.com/dnault'
}
}
}
publishing {
repositories {
maven {
setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
// defined externally in gradle.properties
username = project.properties["ossrhUsername"]
password = project.properties["ossrhPassword"]
}
}
}
publications {
mavenJava(MavenPublication) {
pom.withXml {
asNode().appendNode('description', projectDescription)
asNode().children().last() + pomConfig
}
from components.java
artifact sourceJar {
classifier 'sources'
}
artifact javadocJar {
classifier 'javadoc'
}
}
}
}
signing {
// Use GPG agent
// https://docs.gradle.org/current/userguide/signing_plugin.html#sec:using_gpg_agent
// Requires "signing.gnupg.keyName" property defined externally in gradle.properties
useGpgCmd()
sign publishing.publications.mavenJava
}
task install {
dependsOn(publishToMavenLocal)
}
tasks.withType(JavaCompile) {
// retain parameter names in class files
options.compilerArgs << "-parameters"
}
test {
testLogging {
exceptionFormat = 'full'
}
}
checkstyle {
toolVersion = "6.16.1"
}
spotbugs {
ignoreFailures = true
excludeFilter = file("config/findbugs/findbugs-exclude.xml")
}
spotbugsMain {
reports {
html {
enabled = true
destination = file("$buildDir/reports/spotbugs/main/spotbugs.html")
stylesheet = 'fancy-hist.xsl'
}
}
}
asciidoctor {
attributes 'source-highlighter': 'coderay',
// toc: '',
idprefix: '',
idseparator: '-',
'data-uri': '',
example: "${projectDir}/examples/src/main/java/com/github/therapi/example/"
// icons : '',
// 'data-uri' : ''
}
// Prohibit snapshot dependencies unless we're building a snapshot
if (!version.endsWith("SNAPSHOT")) {
configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.version.endsWith("-SNAPSHOT")) {
throw new GradleException("Can't release with SNAPSHOT dependency: $details.requested")
}
}
}
}