16
16
* - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
17
17
*/
18
18
19
+ buildscript {
20
+ repositories {
21
+ mavenCentral()
22
+ }
23
+ dependencies {
24
+ classpath ' biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0'
25
+ }
26
+ };
27
+
19
28
plugins {
20
29
id(" net.ltgt.errorprone" ) version " 0.8.1" apply false
21
30
}
22
31
23
32
apply(plugin : " java" );
24
33
apply(plugin : " maven" );
25
34
apply(plugin : " signing" );
26
- apply(plugin : " osgi " );
35
+ apply(plugin : " biz.aQute.bnd.builder " );
27
36
apply(plugin : " idea" );
28
37
apply(plugin : " eclipse" );
29
38
apply(plugin : " net.ltgt.errorprone" );
30
39
31
- group = " com.github.java-json-tools" ;
32
-
33
- version = " 0.8.2-SNAPSHOT" ;
34
- sourceCompatibility = JavaVersion . VERSION_1_7 ;
35
- targetCompatibility = JavaVersion . VERSION_1_7 ; // defaults to sourceCompatibility
40
+ apply(from : " project.gradle" );
36
41
37
- project. ext {
38
- description = " Sample JSON Schema related processors using json-schema-core and various external libraries" ;
39
- };
42
+ group = " com.github.java-json-tools" ;
40
43
44
+ ext. forRelease = ! version. endsWith(" -SNAPSHOT" );
41
45
42
46
/*
43
47
* Repositories to use
44
48
*/
45
49
repositories {
46
50
mavenCentral();
51
+ if (! forRelease) {
52
+ maven {
53
+ url " https://oss.sonatype.org/content/repositories/snapshots"
54
+ }
55
+ }
56
+ /* Allow staging references for last pre-release testing. */
57
+ if (project. properties. containsKey(" sonatypeUsername" )) {
58
+ maven {
59
+ url " https://oss.sonatype.org/service/local/staging/deploy/maven2"
60
+ credentials {
61
+ username = project. properties[" sonatypeUsername" ]
62
+ password = project. properties[" sonatypePassword" ]
63
+ }
64
+ }
65
+ }
47
66
}
48
67
49
-
50
68
/*
51
- * List of dependencies
69
+ * Add errorprone checking.
52
70
*/
53
71
dependencies {
54
72
errorprone(" com.google.errorprone:error_prone_core:2.3.3" )
55
73
errorproneJavac(" com.google.errorprone:javac:9+181-r4173-1" )
56
- compile(group : " com.github.java-json-tools" , name : " json-schema-validator" ,
57
- version : " 2.2.12" );
58
- compile(group : " com.github.reinert" , name : " jjschema" , version : " 0.6" ) {
59
- exclude(group : " com.google.guava" , module : " guava" );
60
- exclude(group : " com.fasterxml.jackson.core" , module : " jackson-core" );
61
- exclude(group : " com.fasterxml.jackson.core" , module : " jackson-databind" );
62
- }
63
- compile(group : " com.googlecode.jsonschema2pojo" ,
64
- name : " jsonschema2pojo-core" , version : " 0.3.5" ) {
65
- exclude(group : " com.fasterxml.jackson.core" , module : " jackson-core" );
66
- exclude(group : " com.fasterxml.jackson.core" , module : " jackson-databind" );
67
- }
68
- compile(group : " com.github.java-json-tools" , name : " json-schema-avro" ,
69
- version : " 0.1.5" );
70
- compile(group : " com.github.java-json-tools" , name : " json-patch" ,
71
- version : " 1.11" );
72
- testCompile(group : " org.testng" , name : " testng" , version : " 6.8.7" ) {
73
- exclude(group : " junit" , module : " junit" );
74
- exclude(group : " org.beanshell" , module : " bsh" );
75
- exclude(group : " org.yaml" , module : " snakeyaml" );
76
- };
77
- testCompile(group : " org.mockito" , name : " mockito-core" , version : " 2.28.2" );
78
- }
79
-
80
- javadoc {
81
- options {
82
- def currentJavaVersion = org.gradle.api.JavaVersion . current()
83
- // FIXME: https://github.com/gradle/gradle/issues/11182
84
- if (currentJavaVersion. compareTo(org.gradle.api.JavaVersion . VERSION_1_9 ) >= 0 ) {
85
- addStringOption(" -release" , " 7" );
86
- }
87
- links(" https://docs.oracle.com/javase/7/docs/api/" );
88
- links(" https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.1/" );
89
- links(" https://fasterxml.github.com/jackson-databind/javadoc/2.2.0/" );
90
- links(" https://www.javadoc.io/doc/com.google.guava/guava/16.0.1/" );
91
- links(" https://fge.github.io/msg-simple/" );
92
- }
93
74
}
94
75
95
76
/*
96
77
* Necessary! Otherwise TestNG will not be used...
97
78
*
98
- * Also, we don't want gradle's default HTML report: it does not support
99
- * parameterized tests which I use a _lot_.
100
79
*/
101
80
test {
102
81
useTestNG() {
@@ -112,6 +91,20 @@ task sourcesJar(type: Jar, dependsOn: classes) {
112
91
from sourceSets. main. allSource;
113
92
}
114
93
94
+ /*
95
+ * Lint all the things!
96
+ */
97
+ allprojects {
98
+ gradle. projectsEvaluated {
99
+ tasks. withType(JavaCompile ) {
100
+ options. compilerArgs << " -Xlint:all" << " -Xlint:-serial" << " -Werror"
101
+ }
102
+ tasks. withType(Javadoc ) {
103
+ options. addStringOption(' Xwerror' , ' -quiet' )
104
+ }
105
+ }
106
+ }
107
+
115
108
/*
116
109
* Javadoc: we need to tell where the overview.html is, it will not pick it up
117
110
* automatically...
@@ -126,29 +119,10 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
126
119
from javadoc. destinationDir;
127
120
}
128
121
129
- // fatJar {
130
- // classifier = "full";
131
- // }
132
-
133
- /*
134
- * Lint all the things!
135
- */
136
- allprojects {
137
- gradle. projectsEvaluated {
138
- tasks. withType(JavaCompile ) {
139
- options. compilerArgs << " -Xlint:all" << " -Xlint:-serial" << " -Werror"
140
- }
141
- tasks. withType(Javadoc ) {
142
- options. addStringOption(' Xwerror' , ' -quiet' )
143
- }
144
- }
145
- }
146
-
147
122
artifacts {
148
123
archives jar;
149
124
archives sourcesJar;
150
125
archives javadocJar;
151
- // bad idea: archives fatJar;
152
126
}
153
127
154
128
wrapper {
@@ -167,7 +141,7 @@ task pom {
167
141
*/
168
142
169
143
project. ext {
170
- scmUrl
= sprintf (
" [email protected] :java-json-tools/%s.git" , name)
144
+ scmUrl
= sprintf (
" [email protected] :java-json-tools/%s.git" , name)
;
171
145
projectURL = sprintf (" https://github.com/java-json-tools/%s" , name);
172
146
sonatypeStaging = " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ;
173
147
sonatypeSnapshots = " https://oss.sonatype.org/content/repositories/snapshots/" ;
@@ -180,7 +154,7 @@ task checkSigningRequirements {
180
154
requiredProperties. each {
181
155
if (project. properties[it] == null ) {
182
156
noDice = true ;
183
- System . err. printf (" property \" %s\" is not defined!" )
157
+ System . err. printf (" property \" %s\" is not defined!\n " , it);
184
158
}
185
159
}
186
160
if (noDice)
@@ -222,9 +196,9 @@ uploadArchives {
222
196
uploadArchives. repositories. mavenDeployer
223
197
]* . pom* . whenConfigured { pom ->
224
198
pom. project {
225
- name " ${ name} " ;
199
+ name " ${ project. name} " ;
226
200
packaging " jar" ;
227
- description " ${ description} " ;
201
+ description " ${ project.ext. description} " ;
228
202
url " ${ projectURL} " ;
229
203
230
204
scm {
@@ -256,7 +230,6 @@ uploadArchives {
256
230
}
257
231
}
258
232
259
- ext. forRelease = ! version. endsWith(" -SNAPSHOT" );
260
233
signing {
261
234
required { forRelease && gradle. taskGraph. hasTask(" uploadArchives" ) };
262
235
sign configurations. archives;
0 commit comments