This message was deleted.
# community-support
s
This message was deleted.
e
I understand the cause (implicit_dependency), but these are 2 official plugins and I did not find any other similar questions from Github issues or SO. Thus I’m confused that if any particular settings will cause this. I don’t think manually add those those dependency statement is a good idea for end user.
a
my guess is that this config is causing the problem
Copy code
artifact(javadocJar.get())
            from(components["java"])
because the Java component already contains the Javadoc JAR. Try commenting it out
Copy code
//artifact(javadocJar.get())
            from(components["java"])
👍 1
e
Hi Adam, really a good shot! It fixed the above error. However I still have :
Reason: 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.
a
ah nice
are you writing and publishing a Gradle plugin?
I think that the Gradle Publish Plugin, or maybe even the
gradle-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 doubled
e
So this time looks like my custom-publication becomes a pre task for “pluginMaven”
Well…the script is writing for both normal Kotlin library and Gradle Plugin. From your point of view, I should split the publish definition I guess? I think I got the idea to leverage
pluginMaven
, like this https://github.com/Triple-T/gradle-play-publisher/blob/master/play/plugin/build.gradle.kts#L81
Thanks again for saving me. It took my 2 nights already 🤣
a
no problem :) Keep the questions coming
There’s a few ways of solving it. What I would prefer is to only set the conventions for all publications in your convention plugin, but don’t add any components. Then you can re-use the plugin for multiple subprojects, and then in the subprojects specifically add a component where required.
so in your convention plugin use
configureEach {}
Copy code
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
Copy code
publishing {
    publications {
        create<MavenPublication>("PolyfillArtifact") {
            artifact(javadocJar.get())
            from(components["java"])
        }
    }
}
some projects create a util function in buildSrc that contains the
create<MavenPublication>(…) {}
code, if it’s repeated a lot
e
That is another good practice! Points taken 🙂
👍 1