11import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
2- import java.net.URI
32
43plugins {
4+ signing
55 kotlin(" jvm" ) apply false
6- id(" org.jetbrains.dokka" ) apply false
7- id(" io.github.gradle-nexus.publish-plugin" ) version " 1.3.0"
6+ alias(libs.plugins.com.vanniktech.maven.publish) apply false
87}
98
10-
119subprojects {
1210
1311 plugins.withId(" org.jetbrains.kotlin.jvm" ) {
@@ -22,34 +20,29 @@ subprojects {
2220 }
2321 }
2422
25-
2623 plugins.withType<JavaPlugin > {
2724
2825 configure<JavaPluginExtension > {
2926 withSourcesJar()
30- withJavadocJar()
27+ // We don't publish Javadoc, because it is useless in out case. We publish sources, plus it is easy to find
28+ // GitHub project and read the source code. We don't have any comprehensive documentation, so let's just publish nothing.
29+ // Additionally, JavaDoc task conflicts with publishing plugin, so let's simply delete one of them.
30+ // withJavadocJar()
3131 }
3232
3333 tasks.withType<Test > {
3434 useJUnitPlatform()
35+ // store all temporary results inside the Gradle folder
3536 systemProperty(" java.io.tmpdir" , layout.buildDirectory.dir(" tmp" ))
3637 }
3738
3839 plugins.withType<MavenPublishPlugin > {
39-
40- with (the<PublishingExtension >()) {
41- publications.create<MavenPublication >(" mavenJava" ) {
42- from(components[" java" ])
43- }
44- }
40+ plugins.apply (com.vanniktech.maven.publish.MavenPublishPlugin ::class )
4541 }
4642 }
4743
4844
4945 plugins.withType<MavenPublishPlugin > {
50-
51- plugins.apply (SigningPlugin ::class )
52-
5346 val publishing = the<PublishingExtension >()
5447
5548 publishing.publications.withType<MavenPublication > {
@@ -91,43 +84,6 @@ subprojects {
9184 url = file(layout.buildDirectory.dir(" repos/releases" )).toURI()
9285 }
9386 }
94-
95- with (the<SigningExtension >()) {
96- sign(publishing.publications)
97- }
98- }
99-
100-
101- plugins.withId(" org.jetbrains.dokka" ) {
102-
103- val dokkaVersion: String by extra
104-
105- dependencies {
106- " dokkaJavadocPlugin" (" org.jetbrains.dokka:kotlin-as-java-plugin:$dokkaVersion " )
107- }
108-
109- tasks.withType<Jar >().matching { it.name == " javadocJar" }
110- .configureEach {
111- from(tasks.named(" dokkaJavadoc" ))
112- }
113-
114- tasks.withType< org.jetbrains.dokka.gradle.DokkaTask > {
115- dependsOn(" classes" )
116- dokkaSourceSets {
117- named(" main" ) {
118- sourceLink {
119- val githubUrl = project.extra[" github.url" ] as String
120- localDirectory.set(project.file(" src/main/kotlin" ))
121- remoteUrl.set(URI (" $githubUrl /tree/master/" ).toURL())
122- remoteLineSuffix.set(" #L" )
123- }
124- }
125- }
126- }
12787 }
12888}
12989
130-
131- nexusPublishing.repositories {
132- sonatype()
133- }
0 commit comments