Skip to content

Commit

Permalink
Setup gradle plugin for correct snapshot publication
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp94831 committed Feb 28, 2024
1 parent 08d5f0e commit 36c16fe
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
```
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=1.2.5-SNAPSHOT
version=1.2.6-SNAPSHOT
org.gradle.caching=true
org.gradle.parallel=true
16 changes: 8 additions & 8 deletions sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,16 @@ class SonatypePlugin : Plugin<Project> {
apply(plugin = "signing")
apply(plugin = "org.gradle.maven-publish")

project.tasks.matching { it.name == "dokkaJavadoc" }.all {
val javadocTask: Task = this
val main: SourceSet = the<JavaPluginExtension>().sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME)
tasks.create<Jar>(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<JavaPluginExtension>().sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME)
tasks.create<Jar>(main.javadocJarTaskName) {
archiveClassifier.set(JAVADOC)
from(javadocTask)
}
}
}

project.plugins.matching { it is JavaPlugin }.all {
configure<JavaPluginExtension> {
withSourcesJar()
withJavadocJar()
Expand Down

0 comments on commit 36c16fe

Please sign in to comment.