11import org.gradle.internal.os.OperatingSystem
22
33plugins {
4- id ' java'
54 id ' java-library'
65 id ' maven-publish'
76 id ' jacoco'
8- id ' com.github.kt3k.coveralls' version ' 2.12.0 '
7+ id ' com.github.kt3k.coveralls' version ' 2.12.2 '
98 id " org.gradle.test-retry" version " 1.1.9"
109 id ' io.github.gradle-nexus.publish-plugin' version ' 1.1.0'
1110 id ' signing'
1211}
1312
14- def jarVersion = " 2.0.2 "
13+ def jarVersion = " 2.21.0.TEST.1 "
1514group = ' io.nats'
1615
1716def isMerge = System . getenv(" BUILD_EVENT" ) == " push"
@@ -20,19 +19,24 @@ def isRelease = System.getenv("BUILD_EVENT") == "release"
2019// version is the variable the build actually uses.
2120version = isRelease ? jarVersion : jarVersion + " -SNAPSHOT"
2221
22+ // Apply a specific Java toolchain to ease working on different environments.
2323java {
24- sourceCompatibility = JavaVersion . VERSION_1_8
25- targetCompatibility = JavaVersion . VERSION_1_8
24+ toolchain {
25+ languageVersion = JavaLanguageVersion . of(21 )
26+ }
27+ withJavadocJar()
28+ withSourcesJar()
2629}
2730
2831repositories {
2932 mavenCentral()
3033 maven { url " https://oss.sonatype.org/content/repositories/releases/" }
34+ maven { url " https://repo1.maven.org/maven2/" }
3135}
3236
3337dependencies {
34- testImplementation ' org.junit.jupiter:junit-jupiter:5.7.0 '
35- testImplementation ' nl.jqno.equalsverifier:equalsverifier:3.12.3 '
38+ testImplementation ' org.junit.jupiter:junit-jupiter:5.7.1 '
39+ testImplementation ' nl.jqno.equalsverifier:equalsverifier:4.0 '
3640}
3741
3842test {
@@ -45,9 +49,10 @@ test {
4549}
4650
4751javadoc {
52+ options. addBooleanOption(' html5' , true )
4853 options. overview = ' src/main/javadoc/overview.html' // relative to source root
4954 source = sourceSets. main. allJava
50- title = " NATS.IO Java NKeys "
55+ title = " NATS.IO JNats JSON "
5156 classpath = sourceSets. main. runtimeClasspath
5257 doLast {
5358 if (! OperatingSystem . current(). isWindows()) {
@@ -66,37 +71,6 @@ javadoc {
6671 }
6772}
6873
69- task javadocJar (type : Jar ) {
70- archiveClassifier. set(' javadoc' )
71- from javadoc
72- }
73-
74- task sourcesJar (type : Jar ) {
75- archiveClassifier. set(' sources' )
76- from sourceSets. main. allSource
77- }
78-
79- jacoco {
80- toolVersion = " 0.8.6"
81- }
82-
83- jacocoTestReport {
84- reports {
85- xml. enabled = true // coveralls plugin depends on xml format report
86- html. enabled = true
87- }
88- afterEvaluate { // only report on main library not examples
89- classDirectories. setFrom(files(classDirectories. files. collect {
90- fileTree(dir : it,
91- exclude : [' **/examples**' ])
92- }))
93- }
94- }
95-
96- artifacts {
97- archives javadocJar, sourcesJar
98- }
99-
10074if (isMerge || isRelease) {
10175 nexusPublishing {
10276 repositories {
@@ -113,14 +87,18 @@ if (isMerge || isRelease) {
11387publishing {
11488 publications {
11589 mavenJava(MavenPublication ) {
90+ artifactId = archivesBaseName
11691 from components. java
117- artifact sourcesJar
118- artifact javadocJar
92+ versionMapping {
93+ usage(' java-api' ) {
94+ fromResolutionOf(' runtimeClasspath' )
95+ }
96+ usage(' java-runtime' ) {
97+ fromResolutionResult()
98+ }
99+ }
119100 pom {
120- name = rootProject. name
121- packaging = ' jar'
122- groupId = group
123- artifactId = archivesBaseName
101+ name = ' JNats Json'
124102 description = ' JSON Parser built specifically for JNATS'
125103 url = ' https://github.com/nats-io/nats.java.json'
126104 licenses {
@@ -134,7 +112,7 @@ publishing {
134112 id = " synadia"
135113 name = " Synadia"
136114 email = " info@synadia.com"
137- url = " https://nats .io"
115+ url = " https://synadia .io"
138116 }
139117 }
140118 scm {
@@ -143,6 +121,14 @@ publishing {
143121 }
144122 }
145123 }
124+ // repositories {
125+ // maven {
126+ // // change URLs to point to your repos, e.g. http://my.org/repo
127+ // def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/"
128+ // def snapshotsRepoUrl = layout.buildDirectory.dir("https://central.sonatype.com/repository/maven-snapshots/")
129+ // url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
130+ // }
131+ // }
146132}
147133
148134if (isRelease) {
@@ -154,4 +140,4 @@ if (isRelease) {
154140 sign configurations. archives
155141 sign publishing. publications. mavenJava
156142 }
157- }
143+ }
0 commit comments