Skip to content

Commit 9c66c86

Browse files
authored
Gradle legacy Archives are not published (#748)
1 parent effcca7 commit 9c66c86

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

build-info-extractor-gradle/src/main/groovy/org/jfrog/gradle/plugin/artifactory/extractor/listener/ProjectsEvaluatedBuildListener.groovy

+8-3
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ public class ProjectsEvaluatedBuildListener extends BuildAdapter implements Proj
148148
String publicationsNames = clientConfig.publisher.getPublications()
149149
if (publishingExtension != null && StringUtils.isNotBlank(publicationsNames)) {
150150
addPublications(artifactoryTask, publishingExtension, publicationsNames)
151-
} else if (projectHasOneOfComponents(artifactoryTask.project, "java", "javaPlatform")) {
152-
addDefaultPublicationsOrConfigurations(artifactoryTask, publishingExtension);
151+
} else {
152+
addDefaultPublicationsOrConfigurations(artifactoryTask, publishingExtension)
153153
}
154154
}
155155
artifactoryTask.projectEvaluated()
@@ -210,6 +210,9 @@ public class ProjectsEvaluatedBuildListener extends BuildAdapter implements Proj
210210
*/
211211
private void addDefaultPublicationsOrConfigurations(ArtifactoryTask artifactoryTask, @Nullable PublishingExtension publishingExtension) {
212212
if (publishingExtension != null) {
213+
if (!projectHasOneOfComponents(artifactoryTask.project, "java", "javaPlatform")) {
214+
return
215+
}
213216
Project project = artifactoryTask.project;
214217
// Add mavenWeb publication if war task exists and enabled
215218
Task warTask = project.tasks.findByName("war");
@@ -231,7 +234,9 @@ public class ProjectsEvaluatedBuildListener extends BuildAdapter implements Proj
231234

232235
// Add publications to Artifactory task
233236
artifactoryTask.addDefaultPublications()
234-
} else {
237+
} else if (artifactoryTask.project.plugins.hasPlugin("maven")) {
238+
// Only if the legacy Maven plugin is applied, add the default legacy Archive Configurations.
239+
// The purpose of this filter is to prevent the addition of legacy Archive Configurations when using new Gradle versions.
235240
artifactoryTask.addDefaultArchiveConfiguration()
236241
}
237242
}

0 commit comments

Comments
 (0)