1+ import io.github.zenhelix.gradle.plugin.task.PublishBundleMavenCentralTask
12import pl.allegro.tech.build.axion.release.domain.PredefinedVersionCreator
23
34plugins {
45 `maven- publish`
5- id( " io.github.gradle-nexus.publish-plugin " ) version " 2.0.0 "
6- id( " pl.allegro.tech.build.axion-release " ) version " 1.18.16 "
6+ alias(libs.plugins.axion)
7+ alias(libs.plugins.mavenCentralPublish) apply false
78}
89
910description = " JavaCAN is a binding to Linux' socketcan subsystem that feels native to Java developers."
@@ -26,12 +27,6 @@ allprojects {
2627 version = gitVersion
2728}
2829
29- nexusPublishing {
30- this .repositories {
31- sonatype()
32- }
33- }
34-
3530val publishAllToMavenLocal by tasks.registering(DefaultTask ::class ) {
3631 group = " publishing"
3732
@@ -59,11 +54,20 @@ val mavenCentralDeploy by tasks.registering(DefaultTask::class) {
5954 group = " publishing"
6055 val isSnapshot = project.version.toString().endsWith(" -SNAPSHOT" )
6156
62- val publishTasks = subprojects
63- .flatMap { it.tasks.withType<PublishToMavenRepository >() }
64- .filter { it.repository.name == " sonatype" }
65- dependsOn(publishTasks)
66- if (! isSnapshot) {
67- dependsOn(tasks.closeAndReleaseStagingRepositories)
57+ if (isSnapshot) {
58+ logger.lifecycle(" Snapshot deployment!" )
59+ for (project in allprojects) {
60+ val tasks = project.tasks
61+ .withType<PublishToMavenRepository >()
62+ .matching { it.repository.name == " mavenCentralSnapshots" }
63+ dependsOn(tasks)
64+ }
65+ } else {
66+ logger.lifecycle(" Release deployment!" )
67+ for (project in allprojects) {
68+ val tasks = project.tasks
69+ .withType<PublishBundleMavenCentralTask >()
70+ dependsOn(tasks)
71+ }
6872 }
6973}
0 commit comments