@@ -3,10 +3,13 @@ import java.text.SimpleDateFormat
3
3
plugins {
4
4
id ' java'
5
5
id ' java-library'
6
+ id ' jvm-test-suite'
6
7
id ' maven-publish'
7
8
id ' signing'
8
- id " biz.aQute.bnd.builder" version " 6.2.0"
9
- id " io.github.gradle-nexus.publish-plugin" version " 1.0.0"
9
+ id ' groovy'
10
+ id ' biz.aQute.bnd.builder' version ' 6.2.0'
11
+ id ' io.github.gradle-nexus.publish-plugin' version ' 1.0.0'
12
+ id ' com.github.ben-manes.versions' version ' 0.51.0'
10
13
}
11
14
12
15
java {
@@ -53,60 +56,65 @@ repositories {
53
56
mavenLocal()
54
57
}
55
58
56
- apply plugin : ' groovy'
57
-
58
59
jar {
59
60
manifest {
60
61
attributes(' Automatic-Module-Name' : ' org.dataloader' ,
61
- ' -exportcontents' : ' org.dataloader.*' ,
62
- ' -removeheaders' : ' Private-Package' )
62
+ ' -exportcontents' : ' org.dataloader.*' ,
63
+ ' -removeheaders' : ' Private-Package' )
63
64
}
64
65
}
65
66
66
- def slf4jVersion = ' 1.7.30'
67
- def reactiveStreamsVersion = ' 1.0.3'
68
-
69
67
dependencies {
70
- api ' org.slf4j:slf4j-api:' + slf4jVersion
71
- api ' org.reactivestreams:reactive-streams:' + reactiveStreamsVersion
72
-
73
- testImplementation ' org.slf4j:slf4j-simple:' + slf4jVersion
74
- testImplementation ' org.awaitility:awaitility:2.0.0'
75
- testImplementation " org.hamcrest:hamcrest:2.2"
76
- testImplementation ' io.projectreactor:reactor-core:3.6.6'
77
- testImplementation ' com.github.ben-manes.caffeine:caffeine:2.9.0'
78
- testImplementation platform(' org.junit:junit-bom:5.10.2' )
79
- testImplementation ' org.junit.jupiter:junit-jupiter-api'
80
- testImplementation ' org.junit.jupiter:junit-jupiter-params'
81
- testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine'
82
- testImplementation ' io.projectreactor:reactor-core:3.6.6'
68
+ api " org.slf4j:slf4j-api:$slf4j_version "
69
+ api " org.reactivestreams:reactive-streams:$reactive_streams_version "
83
70
}
84
71
85
72
task sourcesJar (type : Jar ) {
86
73
dependsOn classes
87
- classifier ' sources'
74
+ archiveClassifier . set( ' sources' )
88
75
from sourceSets. main. allSource
89
76
}
90
77
91
- task javadocJar (type : Jar , dependsOn : javadoc) {
92
- classifier = ' javadoc'
93
- from javadoc. destinationDir
94
- }
95
-
96
78
javadoc {
97
79
options. encoding = ' UTF-8'
98
80
}
99
81
82
+ task javadocJar (type : Jar , dependsOn : javadoc) {
83
+ archiveClassifier. set(' javadoc' )
84
+ from javadoc. destinationDir
85
+ }
86
+
100
87
artifacts {
101
88
archives sourcesJar
102
89
archives javadocJar
103
90
}
104
91
105
- test {
106
- testLogging {
107
- exceptionFormat = ' full'
92
+ testing {
93
+ suites {
94
+ test {
95
+ useJUnitJupiter(junit_version)
96
+ dependencies {
97
+ // Testing dependencies
98
+ implementation platform(" org.junit:junit-bom:$junit_version " )
99
+ implementation ' org.junit.jupiter:junit-jupiter-api'
100
+ implementation ' org.junit.jupiter:junit-jupiter-params'
101
+ implementation ' org.junit.jupiter:junit-jupiter-engine'
102
+ implementation " org.slf4j:slf4j-simple:$slf4j_version "
103
+ implementation " org.awaitility:awaitility:$awaitility_version "
104
+ implementation " org.hamcrest:hamcrest:$hamcrest_version "
105
+ implementation " io.projectreactor:reactor-core:$reactor_core_version "
106
+ implementation " com.github.ben-manes.caffeine:caffeine:$caffeine_version "
107
+ }
108
+
109
+ targets. configureEach {
110
+ testTask. configure {
111
+ testLogging {
112
+ exceptionFormat = ' full'
113
+ }
114
+ }
115
+ }
116
+ }
108
117
}
109
- useJUnitPlatform()
110
118
}
111
119
112
120
publishing {
@@ -180,9 +188,15 @@ tasks.withType(PublishToMavenRepository) {
180
188
dependsOn build
181
189
}
182
190
183
-
184
- task myWrapper ( type : Wrapper ) {
185
- gradleVersion = ' 6.6.1 '
186
- distributionUrl = " https://services.gradle.org/distributions/gradle- ${ gradleVersion } -all.zip "
191
+ def isNonStable = { String version ->
192
+ def stableKeyword = [ ' RELEASE ' , ' FINAL ' , ' GA ' ] . any { it -> version . toUpperCase() . contains(it) }
193
+ def regex = / ^[0-9,.v-]+(-r)?$ /
194
+ return ! stableKeyword && ! (version ==~ regex)
187
195
}
188
196
197
+ // https://github.com/ben-manes/gradle-versions-plugin
198
+ tasks. named(" dependencyUpdates" ). configure {
199
+ rejectVersionIf {
200
+ isNonStable(it. candidate. version)
201
+ }
202
+ }
0 commit comments