kordamp / kordamp-gradle-plugins

A collection of Gradle plugins
https://kordamp.org/kordamp-gradle-plugins/
Apache License 2.0
138 stars 25 forks source link

publishPluginJar task dependency error when publishing to custom repositories #534

Open goncaloribeiro-rogers opened 8 months ago

goncaloribeiro-rogers commented 8 months ago

When using a task publishMainPublicationToArtifactoryRepository to publish artifacts to a custom repository, the publish step is throwing the error “ Reason: Task ':publishMainPublicationToArtifactoryRepository' uses this output of task ':publishPluginJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are

A workaround was to add the following code to my build.gradle file: afterEvaluate{ def publishPluginJar = tasks.findByName('publishPluginJar') def publishMainPublicationToArtifactoryRepository = tasks.findByName('publishMainPublicationToArtifactoryRepository') publishMainPublicationToArtifactoryRepository.dependsOn(publishPluginJar) }

Basically this code is defining the dependency between the two tasks.