File tree 1 file changed +17
-1
lines changed
build-logic/src/main/kotlin
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ import java.net.URI
2
+
1
3
/*
2
4
* Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
5
*/
@@ -11,7 +13,7 @@ publishing {
11
13
repositories {
12
14
maven {
13
15
name = " mavenCentral"
14
- url = uri( " https://oss.sonatype.org/service/local/staging/deploy/maven2/ " )
16
+ url = mavenCentralRepositoryUri( )
15
17
credentials {
16
18
username = System .getenv(" DOKKA_SONATYPE_USER" )
17
19
password = System .getenv(" DOKKA_SONATYPE_PASSWORD" )
@@ -73,6 +75,20 @@ publishing {
73
75
}
74
76
}
75
77
78
+ /* *
79
+ * Due to Gradle running publishing tasks in parallel, multiple staging repositories
80
+ * can be created within a couple of seconds with artifact files scattered throughout.
81
+ * The safest and most stable option is to publish to a pre-defined staging repository.
82
+ */
83
+ fun mavenCentralRepositoryUri (): URI {
84
+ val repositoryId: String? = System .getenv(" DOKKA_MVN_CENTRAL_REPOSITORY_ID" )
85
+ return if (repositoryId == null ) {
86
+ URI (" https://oss.sonatype.org/service/local/staging/deploy/maven2/" )
87
+ } else {
88
+ URI (" https://oss.sonatype.org/service/local/staging/deployByRepositoryId/$repositoryId " )
89
+ }
90
+ }
91
+
76
92
signing {
77
93
useInMemoryPgpKeys(
78
94
System .getenv(" DOKKA_SIGN_KEY_ID" )?.takeIf (String ::isNotBlank),
You can’t perform that action at this time.
0 commit comments