jfrog / artifactory-gradle-plugin

JFrog Gradle plugin for Build Info extraction and Artifactory publishing.
Apache License 2.0
20 stars 15 forks source link

Ivy publication publishing does not work anymore since Gradle 8.4 #75

Closed mricciuti closed 8 months ago

mricciuti commented 9 months ago

Describe the bug

It is no longer possible to publish Ivy publications with Gradle 8.4: the artifactoryPublish task fails with the exception stack given below.

Using the same version of Artifactory Gradle plugin ans same build script configuration the publishing works fine with Gradle 8.3

This issue comes from some internal Gradle api/method used by Artifactory plugin, that were removed in Gradle 8.4. Especially this one: https://github.com/jfrog/artifactory-gradle-plugin/blob/856ecd46536b356cf95d2abafd744a0192ae1810/src/main/java/org/jfrog/gradle/plugin/artifactory/utils/PublicationUtils.java#L145

is using a method removed in IvyNormalizedPublication : https://github.com/gradle/gradle/blob/bb3bc9e4593cd4938f5bad3329163e4e8b4a3281/subprojects/ivy/src/main/java/org/gradle/api/publish/ivy/internal/publisher/IvyNormalizedPublication.java#L25C14-L25C39

Current behavior

Trying to publish an ivy publication fails with the following stack trace:

$ ./gradlew artifactoryPublish

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':artifactoryPublish'.
> 'org.gradle.api.publish.ivy.internal.publisher.IvyPublicationIdentity org.gradle.api.publish.ivy.internal.publisher.IvyNormalizedPublication.getProjectIdentity()'

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':artifactoryPublish'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:148)

Caused by: java.lang.NoSuchMethodError: 'org.gradle.api.publish.ivy.internal.publisher.IvyPublicationIdentity org.gradle.api.publish.ivy.internal.publisher.IvyNormalizedPublication.getProjectIdentity()'
    at org.jfrog.gradle.plugin.artifactory.utils.PublicationUtils.extractIvyDeployDetails(PublicationUtils.java:145)
    at org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask.collectDetailsFromIvyPublications(ArtifactoryTask.java:142)
    at org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask.collectDeployDetails(ArtifactoryTask.java:125)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
    [ ... ]

Reproduction steps

Using a simple build configuration with Artifactory gradle plugin and Ivy Publish plugin applied, try to publish the ivy publication by executing task artifactoryPublish

Exemple of simple build setup to reproduce easily: https://gist.github.com/mricciuti/6d7f3c15383ba07747fca6cb661f7f55

Expected behavior

The publish task should work as expected, and the ivy publication deployed to the target Artifactory without error.

Artifactory Gradle plugin version

5.1.10

Operating system type and version

Windows 11

JFrog Artifactory version

7.49.10

Gradle version

8.4

yahavi commented 8 months ago

@mricciuti Thanks for reporting this issue. We create https://github.com/jfrog/artifactory-gradle-plugin/pull/82 to fix it. We'll keep you posted.

yahavi commented 8 months ago

@mricciuti We released version 5.1.11 of this plugin. Feel free to upgrade - we'd appreciate your feedback on that!

mricciuti commented 8 months ago

Hi @yahavi , thanks for the fix, I confirm that Ivy publications are now properly supported. Unfortunately, these changes introduced a regression on Maven publication handling in cases where multiple Maven publications exist in the same project: I submitted new issue for that: https://github.com/jfrog/artifactory-gradle-plugin/issues/87

BR.

raxmatillo-github commented 7 months ago

@yahavi increasing plugin version to 5.1.11 worked for me. Thanks👍