@@ -8,6 +8,7 @@ java.sourceCompatibility = JavaVersion.VERSION_1_8
88java.targetCompatibility = JavaVersion .VERSION_1_8
99
1010plugins {
11+ id(" com.vanniktech.maven.publish" ) version " 0.35.0"
1112 `java- library`
1213 `maven- publish`
1314 signing
@@ -23,7 +24,7 @@ dependencies {
2324}
2425
2526java {
26- withJavadocJar()
27+ // withJavadocJar() // Removed to avoid double signing
2728 withSourcesJar()
2829}
2930
@@ -42,60 +43,47 @@ tasks.named<Test>("test") {
4243 useJUnitPlatform()
4344}
4445
45- publishing {
46- repositories {
47- maven {
48- name = " Sonatype"
49- val releasesRepoUrl = " https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
50- val snapshotsRepoUrl = " https://s01.oss.sonatype.org/content/repositories/snapshots"
51- url = uri(if (version.toString().endsWith(" SNAPSHOT" )) snapshotsRepoUrl else releasesRepoUrl)
52- credentials {
53- username = (properties[" ossrhToken" ] as String? )
54- password = (properties[" ossrhTokenPassword" ] as String? )
55- }
56- }
57- maven {
58- name = " Local"
59- val releasesRepoUrl = layout.buildDirectory.dir(" repos/releases" )
60- val snapshotsRepoUrl = layout.buildDirectory.dir(" repos/snapshots" )
61- url = uri(if (version.toString().endsWith(" SNAPSHOT" )) snapshotsRepoUrl else releasesRepoUrl)
62- }
46+ // ✅ FIX ESATTO PER GRADLE 9.2.1 + vanniktech.maven.publish 0.35.0
47+ afterEvaluate {
48+ val plainJavadocJarTask = tasks.findByName(" plainJavadocJar" )
49+ val metadataTask = tasks.findByName(" generateMetadataFileForMavenPublication" )
50+
51+ if (plainJavadocJarTask != null && metadataTask != null ) {
52+ metadataTask.dependsOn(plainJavadocJarTask)
6353 }
64- publications.create<MavenPublication >(" WLDTRelease" ) {
65- from(components[" java" ])
54+ }
6655
67- pom {
68- name = " WLDT Core"
69- url = " https://wldt.github.io/"
70- description = project.description;
71- licenses {
72- license {
73- name = " Apache-2.0 license"
74- url = " https://raw.githubusercontent.com/wldt/wldt-core-java/master/LICENSE"
75- }
76- }
56+ mavenPublishing {
57+ coordinates(group.toString(), name.toString(), version.toString())
7758
78- developers {
79- developer {
80- id = " piconem"
81- name = " Marco Picone"
82- email = " picone.m@gmail.com"
83- }
84- developer {
85- id = " samubura"
86- name = " Samuele Burattini"
87- email = " samuele.burattini@unibo.it"
88- }
59+ pom {
60+ name.set(" WLDT Core" )
61+ description.set(" The WLDT Core Java Module to build Digital Twins" )
62+ inceptionYear.set(" 2025" )
63+ url.set(" https://github.com/wldt/wldt-core-java" )
64+ licenses {
65+ license {
66+ name.set(" WLDT License" )
67+ url.set(" https://github.com/wldt/wldt-core-java/blob/main/LICENSE" )
68+ distribution.set(" https://github.com/wldt/wldt-core-java/blob/main/LICENSE" )
8969 }
90-
91- scm {
92- connection = " scm:git:https://github.com/wldt/wldt-core-java.git"
93- url = " https://github.com/wldt/wldt-core-java"
70+ }
71+ developers {
72+ developer {
73+ id.set(" piconem" )
74+ name.set(" Marco Picone" )
75+ url.set(" https://github.com/piconem" )
76+ }
77+ developer {
78+ id.set(" samubura" )
79+ name.set(" Samuele Burattini" )
80+ url.set(" https://github.com/samubura" )
9481 }
9582 }
83+ scm {
84+ url.set(" https://github.com/wldt/wldt-core-java" )
85+ connection.set(" scm:git:git://github.com/wldt/wldt-core-java.git" )
86+ developerConnection.set(" scm:git:ssh://git@github.com/wldt/wldt-core-java.git" )
87+ }
9688 }
97- }
98-
99- signing {
100- sign(publishing.publications[" WLDTRelease" ])
101- }
89+ }
0 commit comments