Skip to content

Commit 5f1cb81

Browse files
authored
Maven Central publishing configuration (#2)
* Publishing configuration * Removed comments
1 parent e9568e4 commit 5f1cb81

File tree

6 files changed

+34
-63
lines changed

6 files changed

+34
-63
lines changed

Diff for: .github/workflows/publish.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
java-version: '17'
1818
- name: Publish
1919
env:
20-
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
21-
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
22-
OSSRH_USER: ${{ secrets.OSSRH_USER }}
23-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
24-
run: gmake publish prerelease=${{ github.event.release.prerelease }}
20+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
21+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
22+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USER }}
23+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
24+
run: make publish

Diff for: Makefile

+4-13
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,8 @@ FONT_ESC := $(shell printf '\033')
22
FONT_BOLD := ${FONT_ESC}[1m
33
FONT_NC := ${FONT_ESC}[0m # No colour
44

5-
PUBLISH_REPOSITORY := release
65
VERSION := $(shell git describe --tags --match 'v*' --abbrev=0 | cut -c2-)
76

8-
ifeq (true,$(prerelease))
9-
PUBLISH_REPOSITORY := snapshot
10-
else
11-
ifneq (,$(findstring dev,$(VERSION)))
12-
PUBLISH_REPOSITORY := snapshot
13-
endif
14-
endif
15-
167
all:
178
@echo "Use a specific goal. To list all goals, type 'make help'"
189

@@ -48,13 +39,13 @@ static-analysis:
4839
security-analysis:
4940
@./gradlew clean dependencyCheckAnalyze
5041

51-
.PHONY: publish-local # Publishes artifacts locally
52-
publish-local:
53-
@./gradlew clean publishToMavenLocal -Pversion=$(VERSION)
42+
# .PHONY: publish-local # Publishes artifacts locally
43+
# publish-local:
44+
# @./gradlew clean publishToMavenLocal -Pversion=$(VERSION)
5445

5546
.PHONY: publish # Publishes artifacts to the configured remote repository
5647
publish:
57-
@./gradlew clean publish -Pversion=$(VERSION) -PpublishRepository=$(PUBLISH_REPOSITORY)
48+
@./gradlew clean publishToMavenCentral -Pversion=$(VERSION)
5849

5950
.PHONY: help # Generate list of goals with descriptions
6051
help:

Diff for: build.gradle

+22-41
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ plugins {
66
id 'com.github.maiflai.scalatest' version '0.32' apply false
77
id 'org.scoverage' version '8.1' apply false
88
id 'com.github.kt3k.coveralls' version '2.12.2'
9-
id 'maven-publish'
10-
id 'signing'
9+
id "com.vanniktech.maven.publish" version '0.30.0'
1110
}
1211

1312
apply plugin: 'maven-publish'
@@ -45,52 +44,35 @@ if (project.gradle.startParameter.taskNames.contains('integrationTest')) {
4544
apply from: 'gradle/scala.gradle'
4645
}
4746

48-
publishing {
49-
publications {
50-
maven(MavenPublication) {
51-
pom {
52-
name = 'Kafka Connect Kafka connector'
53-
description = 'A connector with a Kafka sink.'
54-
url = 'https://github.com/Segence/kafka-connect-kafka'
55-
licenses {
56-
license {
57-
name = 'The Apache License, Version 2.0'
58-
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
59-
}
60-
}
61-
developers {
62-
developer {
63-
id = 'robvadai'
64-
name = 'Rob Vadai'
65-
66-
}
67-
}
68-
scm {
69-
url = 'https://github.com/Segence/kafka-connect-kafka'
70-
}
47+
mavenPublishing {
48+
coordinates(project.group, project.name, version)
49+
50+
pom {
51+
name = 'Kafka Connect Kafka connector'
52+
description = 'A connector with a Kafka sink.'
53+
inceptionYear = "2024"
54+
url = 'https://github.com/Segence/kafka-connect-kafka'
55+
licenses {
56+
license {
57+
name = 'The Apache License, Version 2.0'
58+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
7159
}
7260
}
73-
}
74-
repositories {
75-
maven {
76-
url = project.hasProperty('publishRepository') && publishRepository == 'release' ? publishReleaseRepositoryUrl : publishSnapshotRepositoryUrl
77-
credentials {
78-
username System.getenv("OSSRH_USER")
79-
password System.getenv("OSSRH_PASSWORD")
61+
developers {
62+
developer {
63+
id = 'robvadai'
64+
name = 'Rob Vadai'
65+
8066
}
8167
}
68+
scm {
69+
url = 'https://github.com/Segence/kafka-connect-kafka'
70+
}
8271
}
8372
}
8473

85-
signing {
86-
def signingKey = findProperty("signingKey")
87-
def signingPassword = findProperty("signingPassword")
88-
useInMemoryPgpKeys(signingKey, signingPassword)
89-
sign publishing.publications.mavenJava
90-
}
91-
9274
dependencies {
93-
compileOnly (
75+
api (
9476
"org.apache.kafka:connect-runtime:${kafkaVersion}",
9577
"io.confluent:kafka-schema-registry-client:${confluentVersion}",
9678
"io.confluent:kafka-avro-serializer:${confluentVersion}",
@@ -102,7 +84,6 @@ dependencies {
10284
"io.confluent:kafka-avro-serializer:${confluentVersion}",
10385
"org.slf4j:slf4j-api:${slf4jVersion}",
10486
"org.slf4j:slf4j-reload4j:${slf4jVersion}",
105-
10687
"org.junit.jupiter:junit-jupiter-api:${junitVersion}",
10788
"org.junit.jupiter:junit-jupiter:${junitVersion}",
10889
"org.junit.platform:junit-platform-runner:${junitPlatformVersion}",

Diff for: gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
systemProp.org.gradle.internal.launcher.welcomeMessageEnabled = false
22
systemProp.https.protocols = TLSv1,TLSv1.1,TLSv1.2
33

4-
publishReleaseRepositoryUrl = https://s01.oss.sonatype.org/service/local/staging/deploy/maven2
5-
publishSnapshotRepositoryUrl = https://s01.oss.sonatype.org/content/repositories/snapshots
4+
SONATYPE_HOST=CENTRAL_PORTAL
5+
RELEASE_SIGNING_ENABLED=true
66

77
scalaVersions = 2.13.14
88
defaultScalaVersions = 2.13.14

Diff for: gradle/java.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apply plugin: 'java'
1+
apply plugin: 'java-library'
22
apply plugin: 'com.github.spotbugs'
33
apply plugin: 'jacoco'
44
apply plugin: 'checkstyle'

Diff for: gradle/scala.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies {
99
"org.scala-lang:scala-library:%scala-version%",
1010
"org.scalatest:scalatest_%%:${scalaTestVersion}",
1111
"org.scalatestplus:junit-5-10_%%:${scalaTestPlusVersion}",
12-
1312
"io.github.embeddedkafka:embedded-kafka-connect_%%:${embeddedKafkaVersion}",
1413
"io.github.embeddedkafka:embedded-kafka-schema-registry_%%:${confluentVersion}",
1514
"com.softwaremill.sttp.client3:core_%%:${sttpVersion}"

0 commit comments

Comments
 (0)