Skip to content

Commit

Permalink
# Add publishing to central sonatype
Browse files Browse the repository at this point in the history
  • Loading branch information
herrrta committed Nov 19, 2024
1 parent 4daa421 commit ed83ff9
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ local.properties
/auth/build/
/core/build/
/sample/build/
/build/
5 changes: 3 additions & 2 deletions auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ kotlin {
}

dependencies {
implementation(projects.core)
api(projects.core)

implementation(libs.ktor.server.core)
implementation(libs.ktor.server.auth)
}
}
46 changes: 44 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
import com.vanniktech.maven.publish.SonatypeHost

plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
alias(libs.plugins.gradle.maven.publish)
alias(libs.plugins.kotlinJvm) apply false
}

val ktorcefulVersion: String by project

allprojects {
group = "dev.herrrta.ktorceful"
version = ktorcefulVersion
}

subprojects {
apply(plugin = "com.vanniktech.maven.publish")
if (name != "sample") {
mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
signAllPublications()

coordinates("dev.herrrta.ktorceful", name, ktorcefulVersion)

pom {
name.set("Ktorceful")
description.set("Ktorceful - Ktor class based resource routing")
url.set("https://github.com/herrrta/ktorceful/")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/herrrta/ktorceful")
connection.set("scm:git:https://github.com/herrrta/ktorceful.git")
}
developers {
developer {
name.set("herrrta")
url.set("https://github.com/herrrta/")
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ dependencies {

testImplementation(libs.ktor.server.test.host)
testImplementation(libs.kotlin.test.junit)
}
}
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ kotlin.daemon.jvmargs=-Xmx2048M
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8

#Ktor
io.ktor.development=true
io.ktor.development=true

#Ktorceful
ktorcefulVersion=0.1
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ junit = "4.13.2"
kotlin = "2.0.21"
ktor = "3.0.0"
logback = "1.5.11"
maven-publish = "0.30.0"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
Expand All @@ -20,4 +21,5 @@ ktor-server-test-host = { module = "io.ktor:ktor-server-test-host", version.ref
[plugins]
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ktor = { id = "io.ktor.plugin", version.ref = "ktor" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
gradle-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }
8 changes: 0 additions & 8 deletions local.properties

This file was deleted.

2 changes: 1 addition & 1 deletion sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ application {
}

dependencies {
implementation(projects.core)
api(projects.core)

implementation(libs.logback)
implementation(libs.ktor.server.core)
Expand Down
24 changes: 7 additions & 17 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,21 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

pluginManagement {
repositories {
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
google()
mavenCentral()
gradlePluginPortal()
}
}

dependencyResolutionManagement {
repositories {
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
google()
mavenCentral()
}
}

include(":core")
include(":auth")
include(":sample")
include(
":core",
":auth",
":sample"
)

0 comments on commit ed83ff9

Please sign in to comment.