|
| 1 | +import com.vanniktech.maven.publish.JavaLibrary |
| 2 | +import com.vanniktech.maven.publish.JavadocJar |
| 3 | +import com.vanniktech.maven.publish.SonatypeHost |
| 4 | + |
1 | 5 | plugins { |
2 | 6 | id 'java-library' |
3 | 7 | id 'checkstyle' |
4 | 8 | id 'jacoco' |
5 | | - id "com.github.spotbugs" version "5.0.14" |
6 | | - id 'maven-publish' |
7 | | - id 'signing' |
8 | | - id "io.codearte.nexus-staging" version "0.30.0" // logs into Sonotype OSS and does a "Close" and "Release" |
| 9 | + id "com.github.spotbugs" version '6.1.11' |
9 | 10 | id 'com.adarshr.test-logger' version '4.0.0' |
10 | | - id "com.github.ben-manes.versions" version "0.51.0" |
11 | | - id 'org.sonatype.gradle.plugins.scan' version '2.8.3' |
12 | | - id "org.sonarqube" version "5.1.0.4882" |
| 11 | + id "com.github.ben-manes.versions" version '0.52.0' |
| 12 | + id 'org.sonatype.gradle.plugins.scan' version '3.1.1' |
| 13 | + id "org.sonarqube" version '6.1.0.5360' |
| 14 | + id 'com.vanniktech.maven.publish' version '0.31.0' |
13 | 15 | } |
14 | 16 |
|
15 | 17 | group = 'com.imsweb' |
16 | | -version = '1.15' |
| 18 | +version = '1.16-SNAPSHOT' |
17 | 19 | description = 'Java client library for parsing x12 files' |
18 | 20 |
|
19 | | -tasks.withType(JavaCompile) { |
20 | | - options.encoding = 'UTF-8' // UTF-8 for all compilation tasks |
21 | | - options.compilerArgs << "-Xlint:all" << "-Werror" // fail the build if there are compiler warnings |
| 21 | +tasks.withType(JavaCompile).configureEach { |
| 22 | + options.encoding = 'UTF-8' |
| 23 | + options.compilerArgs << "-Werror" << "-Xlint:-options" |
22 | 24 | } |
23 | 25 |
|
24 | 26 | java { |
25 | 27 | sourceCompatibility = JavaVersion.VERSION_1_8 |
26 | 28 | targetCompatibility = JavaVersion.VERSION_1_8 |
27 | | - |
28 | | - withJavadocJar() |
29 | | - withSourcesJar() |
30 | 29 | } |
31 | 30 |
|
32 | 31 | repositories { |
33 | 32 | mavenCentral() |
34 | 33 | } |
35 | 34 |
|
36 | 35 | dependencies { |
37 | | - api 'com.thoughtworks.xstream:xstream:1.4.20' |
| 36 | + api 'com.thoughtworks.xstream:xstream:1.4.21' |
38 | 37 |
|
39 | | - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.0' |
40 | | - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.0' |
41 | | - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.0' |
42 | | - testImplementation 'commons-io:commons-io:2.16.1' |
43 | | - testImplementation 'org.jsoup:jsoup:1.18.1' |
| 38 | + testImplementation platform('org.junit:junit-bom:5.12.2') |
| 39 | + testImplementation 'org.junit.jupiter:junit-jupiter-api' |
| 40 | + testImplementation 'org.junit.jupiter:junit-jupiter-params' |
| 41 | + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' |
| 42 | + testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.2' |
| 43 | + |
| 44 | + testImplementation 'commons-io:commons-io:2.19.0' |
| 45 | + testImplementation 'org.jsoup:jsoup:1.20.1' |
44 | 46 | testImplementation 'com.jayway.jsonpath:json-path:2.9.0' |
45 | 47 | } |
46 | 48 |
|
47 | 49 | jar { |
48 | 50 | manifest { |
49 | | - attributes('Implementation-Title': project.name, |
| 51 | + attributes( |
| 52 | + 'Implementation-Title': project.name, |
50 | 53 | 'Implementation-Version': archiveVersion, |
51 | 54 | 'Implementation-Vendor': group, |
52 | 55 | 'Created-By': System.properties['java.vm.version'] + ' (' + System.properties['java.vm.vendor'] + ')', |
@@ -107,97 +110,55 @@ dependencyUpdates { |
107 | 110 | } |
108 | 111 | } |
109 | 112 |
|
110 | | -// don't try to release a snapshot to a non-snapshot repository, that won't work anyway |
111 | | -if (version.endsWith('-SNAPSHOT')) { |
112 | | - gradle.startParameter.excludedTaskNames += 'signMavenJavaPublication' |
113 | | - gradle.startParameter.excludedTaskNames += 'closeAndReleaseRepository' |
114 | | -} |
115 | | - |
116 | | -publishing { |
117 | | - publications { |
118 | | - mavenJava(MavenPublication) { |
119 | | - artifactId = 'x12-parser' |
120 | | - from components.java |
121 | | - versionMapping { |
122 | | - usage('java-api') { |
123 | | - fromResolutionOf('runtimeClasspath') |
124 | | - } |
125 | | - usage('java-runtime') { |
126 | | - fromResolutionResult() |
127 | | - } |
128 | | - } |
129 | | - pom { |
130 | | - name = 'X12 Parser' |
131 | | - description = 'A Java library for parsing X12 files, including ANSI 837' |
132 | | - url = 'https://github.com/imsweb/x12-parser' |
133 | | - inceptionYear = '2015' |
134 | | - |
135 | | - licenses { |
136 | | - license { |
137 | | - name = 'A modified BSD License (BSD)' |
138 | | - url = 'https://github.com/imsweb/x12-parser/blob/master/LICENSE' |
139 | | - distribution = 'repo' |
140 | | - } |
141 | | - } |
142 | | - |
143 | | - developers { |
144 | | - developer { |
145 | | - id = 'AngelaszekD' |
146 | | - name = 'David Angelaszek' |
147 | | - email = 'AngelaszekD@imsweb.com' |
148 | | - } |
149 | | - developer { |
150 | | - id = 'ctmay4' |
151 | | - name = 'Chuck May' |
152 | | - email = 'mayc@imsweb.com' |
153 | | - } |
154 | | - } |
155 | | - |
156 | | - scm { |
157 | | - url = 'https://github.com/imsweb/x12-parser' |
158 | | - connection = 'scm:https://github.com/imsweb/x12-parser.git' |
159 | | - developerConnection = 'scm:git@github.com:imsweb/x12-parser.git' |
160 | | - } |
161 | | - } |
162 | | - } |
163 | | - } |
164 | | - repositories { |
165 | | - maven { |
166 | | - def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2" |
167 | | - def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots" |
168 | | - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl |
169 | | - |
170 | | - credentials { |
171 | | - username = project.findProperty('nexusUsername') ?: '' |
172 | | - password = project.findProperty('nexusPassword') ?: '' |
173 | | - } |
174 | | - } |
175 | | - } |
176 | | -} |
177 | | - |
178 | | -signing { |
179 | | - def signingKey = project.findProperty('signingKey') ?: '' |
180 | | - def signingPassword = project.findProperty('signingPassword') ?: '' |
181 | | - |
182 | | - useInMemoryPgpKeys(signingKey, signingPassword) |
183 | | - |
184 | | - sign publishing.publications.mavenJava |
185 | | -} |
186 | | - |
187 | 113 | javadoc { |
188 | 114 | if (JavaVersion.current().isJava9Compatible()) { |
189 | 115 | options.addBooleanOption('html5', true) |
190 | 116 | options.addStringOption('Xdoclint:none', '-quiet') |
191 | 117 | } |
192 | 118 | } |
193 | 119 |
|
194 | | -// configure nexus staging plugin |
195 | | -nexusStaging { |
196 | | - numberOfRetries = 50 |
197 | | - delayBetweenRetriesInMillis = 5000 |
| 120 | +mavenPublishing { |
| 121 | + configure(new JavaLibrary(new JavadocJar.Javadoc(), true)) |
| 122 | + |
| 123 | + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) |
| 124 | + signAllPublications() |
| 125 | + |
| 126 | + pom { |
| 127 | + name = 'X12 Parser' |
| 128 | + description = 'A Java library for parsing X12 files, including ANSI 837' |
| 129 | + url = 'https://github.com/imsweb/x12-parser' |
| 130 | + inceptionYear = '2015' |
| 131 | + |
| 132 | + licenses { |
| 133 | + license { |
| 134 | + name = 'A modified BSD License (BSD)' |
| 135 | + url = 'https://github.com/imsweb/x12-parser/blob/master/LICENSE' |
| 136 | + distribution = 'repo' |
| 137 | + } |
| 138 | + } |
| 139 | + |
| 140 | + developers { |
| 141 | + developer { |
| 142 | + id = 'AngelaszekD' |
| 143 | + name = 'David Angelaszek' |
| 144 | + email = 'AngelaszekD@imsweb.com' |
| 145 | + } |
| 146 | + developer { |
| 147 | + id = 'ctmay4' |
| 148 | + name = 'Chuck May' |
| 149 | + email = 'mayc@imsweb.com' |
| 150 | + } |
| 151 | + } |
| 152 | + |
| 153 | + scm { |
| 154 | + url = 'https://github.com/imsweb/x12-parser' |
| 155 | + connection = 'scm:https://github.com/imsweb/x12-parser.git' |
| 156 | + developerConnection = 'scm:git@github.com:imsweb/x12-parser.git' |
| 157 | + } |
| 158 | + } |
198 | 159 | } |
199 | 160 |
|
200 | 161 | wrapper { |
201 | | - gradleVersion = '8.10' |
| 162 | + gradleVersion = '8.14' |
202 | 163 | distributionType = Wrapper.DistributionType.ALL |
203 | 164 | } |
0 commit comments