1
1
import org.gradle.internal.os.OperatingSystem
2
2
3
3
plugins {
4
- id ' java'
5
4
id ' java-library'
6
5
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
6
id ' signing'
7
+ id ' io.github.gradle-nexus.publish-plugin' version ' 1.1.0'
12
8
}
13
9
14
- def jarVersion = " 2.0.2 "
10
+ def jarVersion = " 2.21.0.TEST.1 "
15
11
group = ' io.nats'
16
12
17
13
def isMerge = System . getenv(" BUILD_EVENT" ) == " push"
@@ -20,14 +16,19 @@ def isRelease = System.getenv("BUILD_EVENT") == "release"
20
16
// version is the variable the build actually uses.
21
17
version = isRelease ? jarVersion : jarVersion + " -SNAPSHOT"
22
18
19
+ // Apply a specific Java toolchain to ease working on different environments.
23
20
java {
24
- sourceCompatibility = JavaVersion . VERSION_1_8
25
- targetCompatibility = JavaVersion . VERSION_1_8
21
+ toolchain {
22
+ languageVersion = JavaLanguageVersion . of(21 )
23
+ }
24
+ withJavadocJar()
25
+ withSourcesJar()
26
26
}
27
27
28
28
repositories {
29
29
mavenCentral()
30
30
maven { url " https://oss.sonatype.org/content/repositories/releases/" }
31
+ maven { url " https://repo1.maven.org/maven2/" }
31
32
}
32
33
33
34
dependencies {
@@ -45,9 +46,10 @@ test {
45
46
}
46
47
47
48
javadoc {
49
+ options. addBooleanOption(' html5' , true )
48
50
options. overview = ' src/main/javadoc/overview.html' // relative to source root
49
51
source = sourceSets. main. allJava
50
- title = " NATS.IO Java NKeys "
52
+ title = " NATS.IO JNats JSON "
51
53
classpath = sourceSets. main. runtimeClasspath
52
54
doLast {
53
55
if (! OperatingSystem . current(). isWindows()) {
@@ -66,37 +68,6 @@ javadoc {
66
68
}
67
69
}
68
70
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
-
100
71
if (isMerge || isRelease) {
101
72
nexusPublishing {
102
73
repositories {
@@ -113,14 +84,18 @@ if (isMerge || isRelease) {
113
84
publishing {
114
85
publications {
115
86
mavenJava(MavenPublication ) {
87
+ artifactId = archivesBaseName
116
88
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
+ }
119
97
pom {
120
- name = rootProject. name
121
- packaging = ' jar'
122
- groupId = group
123
- artifactId = archivesBaseName
98
+ name = ' JNats Json'
124
99
description = ' JSON Parser built specifically for JNATS'
125
100
url = ' https://github.com/nats-io/nats.java.json'
126
101
licenses {
@@ -134,7 +109,7 @@ publishing {
134
109
id = " synadia"
135
110
name = " Synadia"
136
111
email = " info@synadia.com"
137
- url = " https://nats .io"
112
+ url = " https://synadia .io"
138
113
}
139
114
}
140
115
scm {
@@ -143,15 +118,21 @@ publishing {
143
118
}
144
119
}
145
120
}
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
+ // }
146
129
}
147
130
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