11import aQute.bnd.gradle.Bundle
2- import org.gradle.internal.os.OperatingSystem
32
43plugins {
5- id ' java'
6- id ' java-library'
7- id ' maven-publish'
8- id ' jacoco'
9- // id 'com.github.kt3k.coveralls' version '2.12.2'
10- id ' biz.aQute.bnd.builder' version ' 5.1.2'
11- id " org.gradle.test-retry" version " 1.6.2"
12- id ' io.github.gradle-nexus.publish-plugin' version ' 1.1.0'
13- id ' signing'
4+ id(" java" )
5+ id(" java-library" )
6+ id(" maven-publish" )
7+ id(" jacoco" )
8+ id(" biz.aQute.bnd.builder" ) version " 5.1.2"
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" )
1412}
1513
1614def jarVersion = " 2.24.0"
1715
18- def buildEvent = System . getenv(" BUILD_EVENT" )
19- def isRelease = buildEvent == " release"
16+ def isRelease = System . getenv(" BUILD_EVENT" ) == " release"
2017def brn = System . getenv(" BRANCH_REF_NAME" )
2118def snap = brn == null || brn. equals(" " ) ? " -SNAPSHOT" : " ." + brn + " -SNAPSHOT"
2219
23- // version is the variable the build actually uses.
24- version = isRelease ? jarVersion : jarVersion + snap
25-
26- archivesBaseName = ' jnats'
2720group = ' io.nats'
21+ version = isRelease ? jarVersion : jarVersion + snap // version is the variable the build actually uses.
2822
2923java {
3024 sourceCompatibility = JavaVersion . VERSION_1_8
3125 targetCompatibility = JavaVersion . VERSION_1_8
3226}
3327
3428repositories {
35- gradlePluginPortal()
36- mavenCentral()
37- maven { url " https://repo1.maven.org/maven2/" }
38- maven { url " https://central.sonatype.com/repository/maven-snapshots/" }
39- maven { url " https://oss.sonatype.org/content/repositories/releases/" }
4029 mavenLocal()
30+ mavenCentral()
31+ maven { url= " https://repo1.maven.org/maven2/" }
32+ maven { url= " https://central.sonatype.com/repository/maven-snapshots/" }
4133}
4234
4335dependencies {
44- implementation ' org.bouncycastle:bcprov-lts8on:2.73.8 '
36+ implementation ' org.bouncycastle:bcprov-lts8on:2.73.9 '
4537 implementation ' org.jspecify:jspecify:1.0.0'
4638
47- testImplementation ' org.junit.jupiter:junit-jupiter:5.9.0 '
39+ testImplementation ' org.junit.jupiter:junit-jupiter:5.14.1 '
4840 testImplementation ' io.nats:jnats-server-runner:3.0.1'
4941 testImplementation ' nl.jqno.equalsverifier:equalsverifier:3.12.3'
42+
43+ testRuntimeOnly ' org.junit.platform:junit-platform-launcher'
5044}
5145
5246sourceSets {
@@ -68,15 +62,13 @@ tasks.register('bundle', Bundle) {
6862}
6963
7064jar {
71- manifest {
72- attributes(' Automatic-Module-Name' : ' io.nats.jnats' )
65+ bundle {
66+ bnd(" Bundle-Name" : " io.nats.jnats" ,
67+ " Bundle-Vendor" : " nats.io" ,
68+ " Bundle-Description" : " Java Nats" ,
69+ " Bundle-DocURL" : " https://github.com/nats-io/nats.java"
70+ )
7371 }
74- bnd ([' Implementation-Title' : ' Java Nats' ,
75- ' Implementation-Version' : jarVersion,
76- ' Implementation-Vendor' : ' nats.io' ,
77- " Import-Package" : " !org.bouncycastle:bcprov-lts8on" ]
78- )
79- exclude(" io/nats/examples/**" )
8072}
8173
8274test {
@@ -112,21 +104,6 @@ javadoc {
112104 " **/Debug**"
113105 ]
114106 classpath = sourceSets. main. runtimeClasspath
115- doLast {
116- if (! OperatingSystem . current(). isWindows()) {
117- exec {
118- println " Updating favicon on all html files"
119- workingDir ' build/docs/javadoc'
120- // Only on linux, mac at this point
121- commandLine ' find' , ' .' , ' -name' , ' *.html' , ' -exec' , ' sed' , ' -i' , ' -e' , ' s#<head>#<head><link rel="icon" type="image/ico" href="favicon.ico">#' , ' {}' , ' ;'
122- }
123- copy {
124- println " Copying images to javadoc folder"
125- from ' src/main/javadoc/images'
126- into ' build/docs/javadoc'
127- }
128- }
129- }
130107}
131108
132109tasks. register(' examplesJar' , Jar ) {
@@ -168,8 +145,12 @@ tasks.register('fatJar', Jar) {
168145 with jar
169146}
170147
148+ artifacts {
149+ archives javadocJar, sourcesJar, examplesJar, testsJar
150+ }
151+
171152jacoco {
172- toolVersion = " 0.8.6 "
153+ toolVersion = " 0.8.12 "
173154}
174155
175156jacocoTestReport {
@@ -179,17 +160,12 @@ jacocoTestReport {
179160 }
180161 afterEvaluate { // only report on main library not examples
181162 classDirectories. setFrom(files(classDirectories. files. collect {
182- fileTree(dir : it, exclude : [
183- ' **/examples/**' , ' io/nats/client/tests/**' , ' io/nats/client/support/Debug*'
184- ])
163+ fileTree(dir : it,
164+ exclude : [' **/examples/**' , ' **/Debug**' ])
185165 }))
186166 }
187167}
188168
189- artifacts {
190- archives javadocJar, sourcesJar, examplesJar, testsJar
191- }
192-
193169nexusPublishing {
194170 repositories {
195171 sonatype {
@@ -210,10 +186,10 @@ publishing {
210186 artifact javadocJar
211187 artifact testsJar
212188 pom {
213- name = ' jnats'
214- packaging = ' jar'
189+ name = " jnats"
190+ packaging = " jar"
215191 groupId = group
216- artifactId = archivesBaseName
192+ artifactId = " jnats "
217193 description = ' Client library for working with the NATS messaging system.'
218194 url = ' https://github.com/nats-io/nats.java'
219195 licenses {
0 commit comments