Skip to content

Commit d909835

Browse files
authored
migration from jreleaser to mavenPublish plugin (#277)
#152 ## Motivation and Context To simplify publishing, use the [recommended plugin](https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-publish-libraries.html#set-up-the-publishing-plugin) ## Breaking Changes no ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed
1 parent edbd31d commit d909835

File tree

9 files changed

+43
-149
lines changed

9 files changed

+43
-149
lines changed

.github/workflows/gradle-publish.yml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,16 @@ jobs:
3333
- name: Setup Gradle
3434
uses: gradle/actions/setup-gradle@v4
3535

36-
- name: Verify publication configuration
37-
run: ./gradlew jreleaserConfig
38-
env:
39-
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
40-
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
41-
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
42-
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
43-
JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
44-
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45-
4636
- name: Clean Build with Gradle
4737
run: ./gradlew clean build
48-
env:
49-
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
50-
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
51-
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
52-
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
53-
JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
54-
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
55-
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
5638

5739
- name: Publish to Maven Central Portal
5840
id: publish
59-
run: ./gradlew publish jreleaserFullRelease --info --stacktrace -Djreleaser.verbose=true
41+
run: ./gradlew publishToMavenCentral --no-configuration-cache
6042
env:
61-
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
62-
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
63-
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
64-
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
65-
JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
66-
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
44+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_TOKEN }}
45+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SECRET_KEY }}
46+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSPHRASE }}
6747
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
6848
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}

buildSrc/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ dependencies {
1212
implementation(libs.kotlin.serialization)
1313
implementation(libs.kotlinx.atomicfu.gradle)
1414
implementation(libs.dokka.gradle)
15-
implementation(libs.jreleaser.gradle)
16-
}
15+
implementation(libs.maven.publish)
16+
}

buildSrc/src/main/kotlin/mcp.jreleaser.gradle.kts

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,51 @@
11
plugins {
22
`maven-publish`
3+
id("com.vanniktech.maven.publish")
34
signing
45
}
56

6-
val javadocJar by tasks.registering(Jar::class) {
7-
archiveClassifier.set("javadoc")
8-
}
9-
10-
publishing {
11-
publications.withType<MavenPublication>().configureEach {
12-
if (name.contains("jvm", ignoreCase = true)) {
13-
artifact(javadocJar)
14-
}
7+
mavenPublishing {
8+
signAllPublications()
9+
publishToMavenCentral(automaticRelease = true)
1510

16-
pom {
17-
name = project.name
18-
description = "Kotlin implementation of the Model Context Protocol (MCP)"
19-
url = "https://github.com/modelcontextprotocol/kotlin-sdk"
11+
pom {
12+
name = project.name
13+
description = "Kotlin implementation of the Model Context Protocol (MCP)"
14+
url = "https://github.com/modelcontextprotocol/kotlin-sdk"
2015

21-
licenses {
22-
license {
23-
name = "MIT License"
24-
url = "https://github.com/modelcontextprotocol/kotlin-sdk/blob/main/LICENSE"
25-
distribution = "repo"
26-
}
16+
licenses {
17+
license {
18+
name = "MIT License"
19+
url = "https://github.com/modelcontextprotocol/kotlin-sdk/blob/main/LICENSE"
20+
distribution = "repo"
2721
}
22+
}
2823

29-
organization {
30-
name = "Anthropic"
31-
url = "https://www.anthropic.com"
32-
}
24+
organization {
25+
name = "Anthropic"
26+
url = "https://www.anthropic.com"
27+
}
3328

34-
developers {
35-
developer {
36-
id = "JetBrains"
37-
name = "JetBrains Team"
38-
organization = "JetBrains"
39-
organizationUrl = "https://www.jetbrains.com"
40-
}
29+
developers {
30+
developer {
31+
id = "JetBrains"
32+
name = "JetBrains Team"
33+
organization = "JetBrains"
34+
organizationUrl = "https://www.jetbrains.com"
4135
}
36+
}
4237

43-
scm {
44-
url = "https://github.com/modelcontextprotocol/kotlin-sdk"
45-
connection = "scm:git:git://github.com/modelcontextprotocol/kotlin-sdk.git"
46-
developerConnection = "scm:git:[email protected]:modelcontextprotocol/kotlin-sdk.git"
47-
}
38+
scm {
39+
url = "https://github.com/modelcontextprotocol/kotlin-sdk"
40+
connection = "scm:git:git://github.com/modelcontextprotocol/kotlin-sdk.git"
41+
developerConnection = "scm:git:[email protected]:modelcontextprotocol/kotlin-sdk.git"
4842
}
4943
}
44+
}
5045

46+
publishing {
5147
repositories {
52-
maven {
53-
name = "staging"
54-
url = uri(layout.buildDirectory.dir("staging-deploy"))
55-
}
48+
mavenLocal()
5649
}
5750
}
5851

@@ -68,4 +61,4 @@ signing {
6861
useInMemoryPgpKeys(signingKey.get(), signingPassphrase.get())
6962
sign(publishing.publications)
7063
}
71-
}
64+
}

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ dokka = "2.0.0"
55
atomicfu = "0.29.0"
66
ktlint = "13.1.0"
77
kover = "0.9.1"
8+
mavenPublish = "0.34.0"
9+
binaryCompatibilityValidatorPlugin = "0.18.1"
810

911
# libraries version
1012
serialization = "1.9.0"
@@ -13,8 +15,6 @@ coroutines = "1.10.2"
1315
kotlinx-io = "0.8.0"
1416
ktor = "3.3.0"
1517
logging = "7.0.13"
16-
jreleaser = "1.19.0"
17-
binaryCompatibilityValidatorPlugin = "0.18.1"
1818
slf4j = "2.0.17"
1919
kotest = "6.0.3"
2020
awaitility = "4.3.0"
@@ -30,7 +30,7 @@ kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.
3030
kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
3131
kotlinx-atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }
3232
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
33-
jreleaser-gradle = { module = "org.jreleaser:jreleaser-gradle-plugin", version.ref = "jreleaser" }
33+
maven-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "mavenPublish" }
3434

3535
# Kotlinx libraries
3636
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" }

kotlin-sdk-client/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ plugins {
66
id("mcp.multiplatform")
77
id("mcp.publishing")
88
id("mcp.dokka")
9-
id("mcp.jreleaser")
109
alias(libs.plugins.kotlinx.binary.compatibility.validator)
1110
}
1211

kotlin-sdk-core/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ plugins {
66
id("mcp.multiplatform")
77
id("mcp.publishing")
88
id("mcp.dokka")
9-
id("mcp.jreleaser")
109
alias(libs.plugins.kotlinx.binary.compatibility.validator)
1110
}
1211

kotlin-sdk-server/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ plugins {
22
id("mcp.multiplatform")
33
id("mcp.publishing")
44
id("mcp.dokka")
5-
id("mcp.jreleaser")
65
alias(libs.plugins.kotlinx.binary.compatibility.validator)
76
}
87

kotlin-sdk/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
22
id("mcp.multiplatform")
33
id("mcp.publishing")
4-
id("mcp.jreleaser")
54
}
65

76
kotlin {

0 commit comments

Comments
 (0)