File tree Expand file tree Collapse file tree
plugin/src/main/kotlin/com/vanniktech/maven/publish Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,12 @@ abstract class MavenPublishBaseExtension(
8080 project.tasks.registerDropRepository(buildService)
8181 }
8282
83+ @JvmOverloads
84+ @JvmSynthetic
85+ fun publishToMavenCentral (host : String , automaticRelease : Boolean = false) {
86+ publishToMavenCentral(SonatypeHost .valueOf(host), automaticRelease)
87+ }
88+
8389 /* *
8490 * Automatically apply Gradle's `signing` plugin and configure all publications to be signed. If signing credentials
8591 * are not configured this will fail the build unless the current version is a `SNAPSHOT`.
Original file line number Diff line number Diff line change 11package com.vanniktech.maven.publish
22
3+ import java.io.Serializable
34import org.gradle.api.provider.Provider
45
56/* *
@@ -8,12 +9,9 @@ import org.gradle.api.provider.Provider
89 *
910 * https://central.sonatype.org/articles/2021/Feb/23/new-users-on-s01osssonatypeorg/
1011 */
11- enum class SonatypeHost (
12+ data class SonatypeHost (
1213 internal val rootUrl : String
13- ) {
14- DEFAULT (" https://oss.sonatype.org" ),
15- S01 (" https://s01.oss.sonatype.org" );
16-
14+ ) : Serializable {
1715 internal fun apiBaseUrl (): String {
1816 return " $rootUrl /service/local/"
1917 }
@@ -28,4 +26,19 @@ enum class SonatypeHost(
2826 " $rootUrl /service/local/staging/deployByRepositoryId/${stagingRepositoryId.get()} /"
2927 }
3028 }
29+
30+ companion object {
31+ @JvmStatic
32+ fun valueOf (sonatypeHost : String ): SonatypeHost = when (sonatypeHost) {
33+ " DEFAULT" -> DEFAULT
34+ " S01" -> S01
35+ else -> throw IllegalArgumentException (" No SonatypeHost constant $sonatypeHost " )
36+ }
37+
38+ @JvmField
39+ val DEFAULT = SonatypeHost (" https://oss.sonatype.org" )
40+
41+ @JvmField
42+ val S01 = SonatypeHost (" https://s01.oss.sonatype.org" )
43+ }
3144}
You can’t perform that action at this time.
0 commit comments