11import org.gradle.internal.os.OperatingSystem
22
33plugins {
4+ id ' java'
45 id ' java-library'
56 id ' maven-publish'
67 id ' jacoco'
2425 toolchain {
2526 languageVersion = JavaLanguageVersion . of(21 )
2627 }
27- withJavadocJar()
28- withSourcesJar()
2928}
3029
3130repositories {
@@ -71,6 +70,31 @@ javadoc {
7170 }
7271}
7372
73+ tasks. register(' javadocJar' , Jar ) {
74+ classifier = ' javadoc'
75+ from javadoc
76+ }
77+
78+ tasks. register(' sourcesJar' , Jar ) {
79+ classifier = ' sources'
80+ from sourceSets. main. allSource
81+ }
82+
83+ jacoco {
84+ toolVersion = " 0.8.13"
85+ }
86+
87+ jacocoTestReport {
88+ reports {
89+ xml. enabled = true // coveralls plugin depends on xml format report
90+ html. enabled = true
91+ }
92+ }
93+
94+ artifacts {
95+ archives javadocJar, sourcesJar
96+ }
97+
7498if (isMerge || isRelease) {
7599 nexusPublishing {
76100 repositories {
@@ -87,18 +111,14 @@ if (isMerge || isRelease) {
87111publishing {
88112 publications {
89113 mavenJava(MavenPublication ) {
90- artifactId = archivesBaseName
91114 from components. java
92- versionMapping {
93- usage(' java-api' ) {
94- fromResolutionOf(' runtimeClasspath' )
95- }
96- usage(' java-runtime' ) {
97- fromResolutionResult()
98- }
99- }
115+ artifact sourcesJar
116+ artifact javadocJar
100117 pom {
101- name = ' JNats Json'
118+ name = rootProject. name
119+ packaging = ' jar'
120+ groupId = group
121+ artifactId = archivesBaseName
102122 description = ' JSON Parser built specifically for JNATS'
103123 url = ' https://github.com/nats-io/nats.java.json'
104124 licenses {
@@ -112,7 +132,7 @@ publishing {
112132 id = " synadia"
113133 name = " Synadia"
114134115- url = " https://synadia .io"
135+ url = " https://nats .io"
116136 }
117137 }
118138 scm {
@@ -121,14 +141,6 @@ publishing {
121141 }
122142 }
123143 }
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- // }
132144}
133145
134146if (isRelease) {
0 commit comments