Skip to content

Commit

Permalink
Migrate publishing to Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Trotsenko committed Jun 2, 2024
1 parent b56f63f commit 1661711
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 31 deletions.
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,11 @@ This library is used as backbone of [KeeMobile](https://keemobile.app) password

## Installation

`Kotpass` is published on jitpack.io. Add repository it to your ```build.gradle``` script:
```gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
```
and:
The latest release is available on [Maven Central](https://central.sonatype.com/artifact/app.keemobile/kotpass/overview).

```gradle
```kotlin
dependencies {
implementation 'com.github.keemobile:kotpass:0.9.0'
implementation("app.keemobile:kotpass:0.9.0")
}
```

Expand Down
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ plugins {
alias(libs.plugins.spotless)
alias(libs.plugins.versions)
id("maven-publish")
id("signing")
}

subprojects {
apply {
plugin("com.diffplug.spotless")
plugin("maven-publish")
plugin("signing")
}

spotless {
Expand All @@ -19,6 +22,11 @@ subprojects {
ktlint()
}
}

signing {
useGpgCmd()
sign(publishing.publications)
}
}

tasks.withType<DependencyUpdatesTask> {
Expand Down
21 changes: 21 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,24 @@ org.gradle.jvmargs=-Xmx2048m

# Kotlin
kotlin.code.style=official

# Maven Publish
SONATYPE_HOST=CENTRAL_PORTAL
RELEASE_SIGNING_ENABLED=true

GROUP=app.keemobile
VERSION_NAME=0.9.0

POM_DESCRIPTION=The library offers reading and writing support for KeePass (KDBX) files.
POM_URL=https://github.com/keemobile/kotpass

POM_LICENSE_NAME=MIT
POM_LICENSE_URL=https://opensource.org/licenses/MIT
POM_LICENSE_DIST=repo

POM_SCM_URL=https://github.com/keemobile/kotpass
POM_SCM_CONNECTION=scm:git:git://github.com/keemobile/kotpass.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/keemobile/kotpass.git

POM_DEVELOPER_ID=keemobile
POM_DEVELOPER_NAME=Denis Trotsenko
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ kotest = "5.6.1"
spotless = "6.25.0"
versions = "0.51.0"
kover = "0.8.0"
maven-publish = "0.28.0"

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }

[libraries]
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
Expand Down
23 changes: 3 additions & 20 deletions kotpass/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val ArtifactId = "kotpass"
val ArtifactGroup = "app.keemobile"
val ArtifactVersion = "0.9.0"

plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.dokka)
alias(libs.plugins.kover)
alias(libs.plugins.maven.publish)
id("java-library")
id("maven-publish")
}

group = ArtifactGroup
version = ArtifactVersion
group = properties["GROUP"].toString()
version = properties["VERSION_NAME"].toString()

repositories {
mavenCentral()
Expand All @@ -30,8 +27,6 @@ tasks.withType<KotlinCompile> {
}

java {
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
Expand All @@ -45,18 +40,6 @@ tasks.withType<Jar> {
)
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = ArtifactGroup
artifactId = ArtifactId
version = ArtifactVersion

from(components["java"])
}
}
}

tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets {
configureEach { includes.from("README.md") }
Expand Down
2 changes: 2 additions & 0 deletions kotpass/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
POM_ARTIFACT_ID=kotpass
POM_NAME=kotpass

0 comments on commit 1661711

Please sign in to comment.