Skip to content

Commit e80953a

Browse files
authored
Merge pull request #78 from imsweb/maven-central-portal
Update Maven deployment process
2 parents f8c5e05 + af9661a commit e80953a

File tree

8 files changed

+83
-120
lines changed

8 files changed

+83
-120
lines changed

.github/workflows/integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
uses: actions/setup-java@v3
2020
with:
2121
distribution: 'adopt'
22-
java-version: '17'
22+
java-version: '21'
2323
cache: 'gradle'
2424

2525
- name: Cache SonarCloud packages
26-
uses: actions/cache@v3
26+
uses: actions/cache@v4
2727
with:
2828
path: ~/.sonar/cache
2929
key: ${{ runner.os }}-sonar

.github/workflows/publish.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ jobs:
2121
uses: actions/setup-java@v3
2222
with:
2323
distribution: 'adopt'
24-
java-version: '17'
24+
java-version: '21'
2525
cache: 'gradle'
2626

27-
- name: Publish
27+
- name: Publish to Maven Central (Portal)
2828
run: |
2929
chmod +x gradlew
30-
./gradlew publish closeAndReleaseRepository
30+
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
3131
env:
32-
ORG_GRADLE_PROJECT_nexusUsername: ${{ secrets.NEXUS_USERNAME }}
33-
ORG_GRADLE_PROJECT_nexusPassword: ${{ secrets.NEXUS_PASSWORD }}
34-
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SEER_GPG_SECRET_KEY }}
35-
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SEER_GPG_PASSWORD }}
32+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
33+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
34+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
35+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}

build.gradle

Lines changed: 64 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,55 @@
1+
import com.vanniktech.maven.publish.JavaLibrary
2+
import com.vanniktech.maven.publish.JavadocJar
3+
import com.vanniktech.maven.publish.SonatypeHost
4+
15
plugins {
26
id 'java-library'
37
id 'checkstyle'
48
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'
910
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'
1315
}
1416

1517
group = 'com.imsweb'
16-
version = '1.15'
18+
version = '1.16-SNAPSHOT'
1719
description = 'Java client library for parsing x12 files'
1820

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"
2224
}
2325

2426
java {
2527
sourceCompatibility = JavaVersion.VERSION_1_8
2628
targetCompatibility = JavaVersion.VERSION_1_8
27-
28-
withJavadocJar()
29-
withSourcesJar()
3029
}
3130

3231
repositories {
3332
mavenCentral()
3433
}
3534

3635
dependencies {
37-
api 'com.thoughtworks.xstream:xstream:1.4.20'
36+
api 'com.thoughtworks.xstream:xstream:1.4.21'
3837

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'
4446
testImplementation 'com.jayway.jsonpath:json-path:2.9.0'
4547
}
4648

4749
jar {
4850
manifest {
49-
attributes('Implementation-Title': project.name,
51+
attributes(
52+
'Implementation-Title': project.name,
5053
'Implementation-Version': archiveVersion,
5154
'Implementation-Vendor': group,
5255
'Created-By': System.properties['java.vm.version'] + ' (' + System.properties['java.vm.vendor'] + ')',
@@ -107,97 +110,55 @@ dependencyUpdates {
107110
}
108111
}
109112

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-
187113
javadoc {
188114
if (JavaVersion.current().isJava9Compatible()) {
189115
options.addBooleanOption('html5', true)
190116
options.addStringOption('Xdoclint:none', '-quiet')
191117
}
192118
}
193119

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+
}
198159
}
199160

200161
wrapper {
201-
gradleVersion = '8.10'
162+
gradleVersion = '8.14'
202163
distributionType = Wrapper.DistributionType.ALL
203164
}

config/spotbugs/spotbugs-exclude.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@
1919
<Class name="com.imsweb.x12.reader.X12ReaderTest"/>
2020
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
2121
</Match>
22+
<Match>
23+
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
24+
</Match>
2225
</FindBugsFilter>

gradle/wrapper/gradle-wrapper.jar

181 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)