Skip to content

Commit 4c59987

Browse files
asolntsevclaude
andcommitted
migrate publishing to com.vanniktech.maven.publish plugin
The old oss.sonatype.org NEXUS is shut down (returns 405). Replace hand-rolled maven-publish config with the vanniktech plugin, which targets the new Maven Central portal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f5f9615 commit 4c59987

2 files changed

Lines changed: 40 additions & 59 deletions

File tree

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
buildscript {
2+
repositories {
3+
gradlePluginPortal()
4+
}
5+
dependencies {
6+
classpath "com.vanniktech:gradle-maven-publish-plugin:0.37.0"
7+
}
8+
}
9+
110
subprojects {
211
apply plugin: 'java'
312

gradle/deploy.gradle

Lines changed: 31 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,49 @@
11
subprojects {
2-
apply plugin: 'maven-publish'
2+
apply plugin: "com.vanniktech.maven.publish"
33

4-
jar {
5-
from sourceSets.main.allSource
4+
ext {
5+
groupId = 'com.codeborne.assertlog'
6+
}
67

8+
tasks.withType(Jar).configureEach {
79
manifest {
810
attributes(
9-
"Automatic-Module-Name": project.group + '.' + project.name,
10-
"Implementation-Title": project.group + '.' + project.name,
11+
"Automatic-Module-Name": project.groupId + '.' + project.name,
12+
"Implementation-Title": project.groupId + '.' + project.name,
1113
"Implementation-Version": archiveVersion,
1214
"Implementation-Vendor": "Andrei Solntsev & Codeborne")
1315
}
1416
}
1517

16-
java {
17-
withSourcesJar()
18-
withJavadocJar()
19-
}
20-
21-
publishing {
22-
publications {
23-
mavenJava(MavenPublication) {
24-
from components.java
25-
26-
pom {
27-
name = project.name
28-
packaging = 'jar'
29-
description = 'AssertLog: Unit-tests for your logging'
30-
url = 'https://github.com/java-testkit/assertlog'
31-
32-
scm {
33-
url = 'scm:git@github.com:java-testkit/assertlog.git'
34-
connection = 'scm:git@github.com:java-testkit/assertlog.git'
35-
developerConnection = 'scm:git@github.com:java-testkit/assertlog.git'
36-
}
37-
38-
licenses {
39-
license {
40-
name = 'MIT'
41-
url = 'https://opensource.org/licenses/MIT'
42-
distribution = 'repo'
43-
}
44-
}
18+
mavenPublishing {
19+
if (project.hasProperty("signing.keyId")) {
20+
publishToMavenCentral(true)
21+
signAllPublications()
22+
}
4523

46-
developers {
47-
developer {
48-
id = 'asolntsev'
49-
name = 'Andrei Solntsev'
50-
}
51-
}
24+
coordinates(project.groupId, project.name, project.version)
25+
pom {
26+
name = project.name
27+
description = 'AssertLog: Unit-tests for your logging'
28+
url = 'https://github.com/java-testkit/assertlog'
29+
inceptionYear = '2019'
30+
licenses {
31+
license {
32+
name = 'MIT'
33+
url = 'https://opensource.org/licenses/MIT'
5234
}
5335
}
54-
}
55-
56-
repositories {
57-
maven {
58-
url = version.endsWith('-SNAPSHOT') ?
59-
'https://oss.sonatype.org/content/repositories/snapshots/' :
60-
'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
61-
62-
credentials {
63-
username = findProperty('sonatypeUsername') ?: ''
64-
password = findProperty('sonatypePassword') ?: ''
36+
developers {
37+
developer {
38+
id = 'asolntsev'
39+
name = 'Andrei Solntsev'
6540
}
6641
}
67-
}
68-
}
69-
70-
if (project.hasProperty("signing.keyId")) {
71-
apply plugin: 'signing'
72-
73-
signing {
74-
sign publishing.publications.mavenJava
42+
scm {
43+
connection = 'scm:git@github.com:java-testkit/assertlog.git'
44+
developerConnection = 'scm:git@github.com:java-testkit/assertlog.git'
45+
url = 'https://github.com/java-testkit/assertlog'
46+
}
7547
}
7648
}
7749
}

0 commit comments

Comments
 (0)