1- import org. gradle.internal.os.OperatingSystem
1+ import aQute.bnd. gradle.Bundle
22
33plugins {
4- id ' java'
5- id ' java-library'
6- id ' maven-publish'
7- id ' jacoco'
8- id ' com.github.kt3k.coveralls ' version ' 2.12.0 '
9- id " org.gradle.test-retry" version " 1.1.9 "
10- id ' io.github.gradle-nexus.publish-plugin' version ' 1.1.0 '
11- id ' signing'
4+ id( " java" )
5+ id( " java-library" )
6+ id( " maven-publish" )
7+ id( " jacoco" )
8+ id( " biz.aQute.bnd.builder " ) version " 7.1.0 "
9+ id( " org.gradle.test-retry" ) version " 1.6.4 "
10+ id( " io.github.gradle-nexus.publish-plugin" ) version " 2.0.0 "
11+ id( " signing" )
1212}
1313
14- def jarVersion = " 2.0.2 "
14+ def jarVersion = " 2.1.0 "
1515group = ' io.nats'
1616
17- def isMerge = System . getenv(" BUILD_EVENT" ) == " push"
1817def isRelease = System . getenv(" BUILD_EVENT" ) == " release"
1918
2019// version is the variable the build actually uses.
@@ -27,81 +26,85 @@ java {
2726
2827repositories {
2928 mavenCentral()
30- maven { url " https://oss.sonatype.org/content/repositories/releases/" }
29+ maven { url= " https://repo1.maven.org/maven2/" }
30+ maven { url= " https://central.sonatype.com/repository/maven-snapshots/" }
3131}
3232
3333dependencies {
34- testImplementation ' org.junit.jupiter:junit-jupiter:5.7.0'
35- testImplementation ' com.github.stefanbirkner:system-lambda:1.2.1'
36- testImplementation ' nl.jqno.equalsverifier:equalsverifier:3.12.3'
34+ testImplementation ' org.junit.jupiter:junit-jupiter:5.14.1'
35+ testImplementation ' nl.jqno.equalsverifier:equalsverifier:4.2.1'
36+
37+ testRuntimeOnly ' org.junit.platform:junit-platform-launcher'
38+ }
39+
40+ tasks. register(' bundle' , Bundle ) {
41+ from sourceSets. main. output
42+ }
43+
44+ jar {
45+ bundle {
46+ bnd(" Bundle-Name" : " io.nats.jnats.server.runner" ,
47+ " Bundle-Vendor" : " nats.io" ,
48+ " Bundle-Description" : " NATS.IO Java Server Runner" ,
49+ " Bundle-DocURL" : " https://github.com/nats-io/java-nats-server-runner"
50+ )
51+ }
3752}
3853
3954test {
4055 useJUnitPlatform()
56+ testLogging {
57+ exceptionFormat = ' full'
58+ events " started" , " passed" , " skipped" , " failed"
59+ showStandardStreams = true
60+ }
61+ retry {
62+ failOnPassedAfterRetry = false
63+ maxFailures = 4
64+ maxRetries = 4
65+ }
66+ systemProperty ' junit.jupiter.execution.timeout.default' , ' 3m'
4167}
4268
4369javadoc {
4470 options. overview = ' src/main/javadoc/overview.html' // relative to source root
4571 source = sourceSets. main. allJava
4672 title = " NATS.IO Java Server Runner"
4773 classpath = sourceSets. main. runtimeClasspath
48- doLast {
49- if (! OperatingSystem . current(). isWindows()) {
50- exec {
51- println " Updating favicon on all html files"
52- workingDir ' build/docs/javadoc'
53- // Only on linux, mac at this point
54- commandLine ' find' , ' .' , ' -name' , ' *.html' , ' -exec' , ' sed' , ' -i' , ' -e' , ' s#<head>#<head><link rel="icon" type="image/ico" href="favicon.ico">#' , ' {}' , ' ;'
55- }
56- copy {
57- println " Copying images to javadoc folder"
58- from ' src/main/javadoc/images'
59- into ' build/docs/javadoc'
60- }
61- }
62- }
6374}
6475
65- task javadocJar ( type : Jar ) {
76+ tasks . register( ' javadocJar ' , Jar ) {
6677 archiveClassifier. set(' javadoc' )
6778 from javadoc
6879}
6980
70- task sourcesJar ( type : Jar ) {
81+ tasks . register( ' sourcesJar ' , Jar ) {
7182 archiveClassifier. set(' sources' )
7283 from sourceSets. main. allSource
7384}
7485
86+ artifacts {
87+ archives javadocJar, sourcesJar
88+ }
89+
7590jacoco {
76- toolVersion = " 0.8.6 "
91+ toolVersion = " 0.8.12 "
7792}
7893
7994jacocoTestReport {
8095 reports {
81- xml. enabled = true // coveralls plugin depends on xml format report
82- html. enabled = true
83- }
84- afterEvaluate { // only report on main library not examples
85- classDirectories. setFrom(files(classDirectories. files. collect {
86- fileTree(dir : it,
87- exclude : [' **/examples**' ])
88- }))
96+ xml. required = true // coveralls plugin depends on xml format report
97+ html. required = true
8998 }
9099}
91100
92- artifacts {
93- archives javadocJar, sourcesJar
94- }
95-
96- if (isMerge || isRelease) {
97- nexusPublishing {
98- repositories {
99- sonatype {
100- nexusUrl. set(uri(" https://ossrh-staging-api.central.sonatype.com/service/local/" ))
101- snapshotRepositoryUrl. set(uri(" https://central.sonatype.com/repository/maven-snapshots/" ))
102- username = System . getenv(' OSSRH_USERNAME' )
103- password = System . getenv(' OSSRH_PASSWORD' )
104- }
101+ nexusPublishing {
102+ repositories {
103+ sonatype {
104+ nexusUrl. set(uri(" https://ossrh-staging-api.central.sonatype.com/service/local/" ))
105+ snapshotRepositoryUrl. set(uri(" https://central.sonatype.com/repository/maven-snapshots/" ))
106+ username = System . getenv(' OSSRH_USERNAME' )
107+ password = System . getenv(' OSSRH_PASSWORD' )
105108 }
106109 }
107110}
@@ -113,11 +116,11 @@ publishing {
113116 artifact sourcesJar
114117 artifact javadocJar
115118 pom {
116- name = rootProject . name
117- packaging = ' jar'
119+ name = " jnats-server-runner "
120+ packaging = " jar"
118121 groupId = group
119- artifactId = archivesBaseName
120- description = ' Java NATS.io server runner.'
122+ artifactId = " jnats-server-runner "
123+ description = " Java NATS.io server runner."
121124 url = ' https://github.com/nats-io/java-nats-server-runner'
122125 licenses {
123126 license {
0 commit comments