Slackbot
05/22/2023, 11:35 AMEl Zhang
05/22/2023, 11:38 AMAdam
05/22/2023, 12:49 PMartifact(javadocJar.get())
from(components["java"])
because the Java component already contains the Javadoc JAR. Try commenting it out
//artifact(javadocJar.get())
from(components["java"])
El Zhang
05/22/2023, 1:02 PMReason: Task ‘polyfillpublishPluginMavenPublicationToMyMavenlocalRepository’ uses this output of task ‘polyfillsignPolyfillArtifactPublication’ without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ‘polyfillsignPolyfillArtifactPublication’ as an input of ‘polyfillpublishPluginMavenPublicationToMyMavenlocalRepository’.
2. Declare an explicit dependency on ‘polyfillsignPolyfillArtifactPublication’ from ‘polyfillpublishPluginMavenPublicationToMyMavenlocalRepository’ using Task#dependsOn.
3. Declare an explicit dependency on ‘polyfillsignPolyfillArtifactPublication’ from ‘polyfillpublishPluginMavenPublicationToMyMavenlocalRepository’ using Task#mustRunAfter.
Adam
05/22/2023, 1:04 PMAdam
05/22/2023, 1:04 PMAdam
05/22/2023, 1:05 PMgradle-java-plugin
, will configure the publications automatically. So if your convention plugin is also creating and adding a component, then it’s going to be doubledEl Zhang
05/22/2023, 1:05 PMEl Zhang
05/22/2023, 1:09 PMpluginMaven
, like this https://github.com/Triple-T/gradle-play-publisher/blob/master/play/plugin/build.gradle.kts#L81El Zhang
05/22/2023, 1:10 PMAdam
05/22/2023, 1:10 PMAdam
05/22/2023, 1:12 PMAdam
05/22/2023, 1:14 PMconfigureEach {}
publishing {
publications {
withType<MavenPublication>().configureEach {
//artifact(javadocJar.get())
//from(components["java"])
and then in your specific non-Gradle-plugin subprojects you can create the publication - which will have the defaults set by the convention plugin
publishing {
publications {
create<MavenPublication>("PolyfillArtifact") {
artifact(javadocJar.get())
from(components["java"])
}
}
}
Adam
05/22/2023, 1:14 PMcreate<MavenPublication>(…) {}
code, if it’s repeated a lotEl Zhang
05/22/2023, 1:14 PM