From 9c66c86e37d103f314008c5a3d36137bc81b2a13 Mon Sep 17 00:00:00 2001 From: Yahav Itzhak Date: Tue, 18 Jul 2023 14:23:17 +0300 Subject: [PATCH] Gradle legacy Archives are not published (#748) --- .../listener/ProjectsEvaluatedBuildListener.groovy | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build-info-extractor-gradle/src/main/groovy/org/jfrog/gradle/plugin/artifactory/extractor/listener/ProjectsEvaluatedBuildListener.groovy b/build-info-extractor-gradle/src/main/groovy/org/jfrog/gradle/plugin/artifactory/extractor/listener/ProjectsEvaluatedBuildListener.groovy index 2408902c4..fadde84bd 100644 --- a/build-info-extractor-gradle/src/main/groovy/org/jfrog/gradle/plugin/artifactory/extractor/listener/ProjectsEvaluatedBuildListener.groovy +++ b/build-info-extractor-gradle/src/main/groovy/org/jfrog/gradle/plugin/artifactory/extractor/listener/ProjectsEvaluatedBuildListener.groovy @@ -148,8 +148,8 @@ public class ProjectsEvaluatedBuildListener extends BuildAdapter implements Proj String publicationsNames = clientConfig.publisher.getPublications() if (publishingExtension != null && StringUtils.isNotBlank(publicationsNames)) { addPublications(artifactoryTask, publishingExtension, publicationsNames) - } else if (projectHasOneOfComponents(artifactoryTask.project, "java", "javaPlatform")) { - addDefaultPublicationsOrConfigurations(artifactoryTask, publishingExtension); + } else { + addDefaultPublicationsOrConfigurations(artifactoryTask, publishingExtension) } } artifactoryTask.projectEvaluated() @@ -210,6 +210,9 @@ public class ProjectsEvaluatedBuildListener extends BuildAdapter implements Proj */ private void addDefaultPublicationsOrConfigurations(ArtifactoryTask artifactoryTask, @Nullable PublishingExtension publishingExtension) { if (publishingExtension != null) { + if (!projectHasOneOfComponents(artifactoryTask.project, "java", "javaPlatform")) { + return + } Project project = artifactoryTask.project; // Add mavenWeb publication if war task exists and enabled Task warTask = project.tasks.findByName("war"); @@ -231,7 +234,9 @@ public class ProjectsEvaluatedBuildListener extends BuildAdapter implements Proj // Add publications to Artifactory task artifactoryTask.addDefaultPublications() - } else { + } else if (artifactoryTask.project.plugins.hasPlugin("maven")) { + // Only if the legacy Maven plugin is applied, add the default legacy Archive Configurations. + // The purpose of this filter is to prevent the addition of legacy Archive Configurations when using new Gradle versions. artifactoryTask.addDefaultArchiveConfiguration() } }