11import org.gradle.internal.os.OperatingSystem
22
33plugins {
4- id ' java'
54 id ' java-library'
65 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'
116 id ' signing'
7+ id ' io.github.gradle-nexus.publish-plugin' version ' 1.1.0'
128}
139
14- def jarVersion = " 2.0.2 "
10+ def jarVersion = " 2.21.0.TEST.1 "
1511group = ' io.nats'
1612
1713def isMerge = System . getenv(" BUILD_EVENT" ) == " push"
@@ -20,14 +16,19 @@ def isRelease = System.getenv("BUILD_EVENT") == "release"
2016// version is the variable the build actually uses.
2117version = isRelease ? jarVersion : jarVersion + " -SNAPSHOT"
2218
19+ // Apply a specific Java toolchain to ease working on different environments.
2320java {
24- sourceCompatibility = JavaVersion . VERSION_1_8
25- targetCompatibility = JavaVersion . VERSION_1_8
21+ toolchain {
22+ languageVersion = JavaLanguageVersion . of(21 )
23+ }
24+ withJavadocJar()
25+ withSourcesJar()
2626}
2727
2828repositories {
2929 mavenCentral()
3030 maven { url " https://oss.sonatype.org/content/repositories/releases/" }
31+ maven { url " https://repo1.maven.org/maven2/" }
3132}
3233
3334dependencies {
@@ -45,9 +46,10 @@ test {
4546}
4647
4748javadoc {
49+ options. addBooleanOption(' html5' , true )
4850 options. overview = ' src/main/javadoc/overview.html' // relative to source root
4951 source = sourceSets. main. allJava
50- title = " NATS.IO Java NKeys "
52+ title = " NATS.IO JNats JSON "
5153 classpath = sourceSets. main. runtimeClasspath
5254 doLast {
5355 if (! OperatingSystem . current(). isWindows()) {
@@ -66,37 +68,6 @@ javadoc {
6668 }
6769}
6870
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-
10071if (isMerge || isRelease) {
10172 nexusPublishing {
10273 repositories {
@@ -113,14 +84,18 @@ if (isMerge || isRelease) {
11384publishing {
11485 publications {
11586 mavenJava(MavenPublication ) {
87+ artifactId = archivesBaseName
11688 from components. java
117- artifact sourcesJar
118- artifact javadocJar
89+ versionMapping {
90+ usage(' java-api' ) {
91+ fromResolutionOf(' runtimeClasspath' )
92+ }
93+ usage(' java-runtime' ) {
94+ fromResolutionResult()
95+ }
96+ }
11997 pom {
120- name = rootProject. name
121- packaging = ' jar'
122- groupId = group
123- artifactId = archivesBaseName
98+ name = ' JNats Json'
12499 description = ' JSON Parser built specifically for JNATS'
125100 url = ' https://github.com/nats-io/nats.java.json'
126101 licenses {
@@ -134,7 +109,7 @@ publishing {
134109 id = " synadia"
135110 name = " Synadia"
136111 email = " info@synadia.com"
137- url = " https://nats .io"
112+ url = " https://synadia .io"
138113 }
139114 }
140115 scm {
@@ -143,15 +118,21 @@ publishing {
143118 }
144119 }
145120 }
121+ // repositories {
122+ // maven {
123+ // // change URLs to point to your repos, e.g. http://my.org/repo
124+ // def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/"
125+ // def snapshotsRepoUrl = layout.buildDirectory.dir("https://central.sonatype.com/repository/maven-snapshots/")
126+ // url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
127+ // }
128+ // }
146129}
147130
148- if (isRelease) {
149- signing {
150- def signingKeyId = System . getenv(' SIGNING_KEY_ID' )
151- def signingKey = System . getenv(' SIGNING_KEY' )
152- def signingPassword = System . getenv(' SIGNING_PASSWORD' )
153- useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
154- sign configurations. archives
155- sign publishing. publications. mavenJava
156- }
157- }
131+ signing {
132+ def signingKeyId = System . getenv(' SIGNING_KEY_ID' )
133+ def signingKey = System . getenv(' SIGNING_KEY' )
134+ def signingPassword = System . getenv(' SIGNING_PASSWORD' )
135+ useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
136+ sign configurations. archives
137+ sign publishing. publications. mavenJava
138+ }
0 commit comments