From 36c16fe17f20402f261086471ef7c813744bf0cc Mon Sep 17 00:00:00 2001 From: Philipp Schirmer Date: Wed, 28 Feb 2024 12:07:54 +0100 Subject: [PATCH] Setup gradle plugin for correct snapshot publication --- README.md | 20 +++++++++++++++++++ gradle.properties | 2 +- .../com/bakdata/gradle/SonatypePlugin.kt | 16 +++++++-------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d19caac..adff819 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,24 @@ A collection of small gradle plugin, mostly focused on deployment. **Sonar** Some defaults for easy integration of sonar on multi-module projects **Sonatype** is used for uploading to sonatype repos and ultimately publish to Maven Central +## Development +Snapshot versions of these plugins are published to Sonatype. +You can use them in your project by adding the following snippet to your `build.gradle.kts` + +``` +buildscript { + repositories { + maven { + url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") + } + } + dependencies { + classpath("com.bakdata.gradle:sonar:0.0.1-SNAPSHOT") + classpath("com.bakdata.gradle:sonatype:0.0.1-SNAPSHOT") + } +} + +apply(plugin = "com.bakdata.sonar") +apply(plugin = "com.bakdata.sonatype") +``` diff --git a/gradle.properties b/gradle.properties index 720597a..9185171 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ -version=1.2.5-SNAPSHOT +version=1.2.6-SNAPSHOT org.gradle.caching=true org.gradle.parallel=true diff --git a/sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt b/sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt index e12ecf8..3a038e7 100644 --- a/sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt +++ b/sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt @@ -221,16 +221,16 @@ class SonatypePlugin : Plugin { apply(plugin = "signing") apply(plugin = "org.gradle.maven-publish") - project.tasks.matching { it.name == "dokkaJavadoc" }.all { - val javadocTask: Task = this - val main: SourceSet = the().sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME) - tasks.create(main.javadocJarTaskName) { - archiveClassifier.set(JAVADOC) - from(javadocTask) + project.plugins.matching { it is JavaPlugin }.all { + project.tasks.matching { it.name == "dokkaJavadoc" }.all { + val javadocTask: Task = this + val main: SourceSet = the().sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME) + tasks.create(main.javadocJarTaskName) { + archiveClassifier.set(JAVADOC) + from(javadocTask) + } } - } - project.plugins.matching { it is JavaPlugin }.all { configure { withSourcesJar() withJavadocJar()