From 8e70dbb01a732ce3fc4acd7ea3dc093240137d48 Mon Sep 17 00:00:00 2001 From: yahavi Date: Tue, 20 Aug 2024 14:18:00 +0300 Subject: [PATCH] Make the resolution repository preemptive --- .../jfrog/gradle/plugin/artifactory/utils/PluginUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jfrog/gradle/plugin/artifactory/utils/PluginUtils.java b/src/main/java/org/jfrog/gradle/plugin/artifactory/utils/PluginUtils.java index 7e2b6d2..a34c13c 100644 --- a/src/main/java/org/jfrog/gradle/plugin/artifactory/utils/PluginUtils.java +++ b/src/main/java/org/jfrog/gradle/plugin/artifactory/utils/PluginUtils.java @@ -4,6 +4,7 @@ import org.gradle.api.GradleException; import org.gradle.api.artifacts.repositories.MavenArtifactRepository; import org.gradle.api.invocation.Gradle; +import org.gradle.authentication.http.BasicAuthentication; import org.jfrog.build.api.builder.ModuleType; import org.jfrog.build.api.util.Log; import org.jfrog.build.client.Version; @@ -58,7 +59,6 @@ public static ModuleType getModuleType(String moduleType) { public static void addArtifactoryResolutionRepositoryAction(MavenArtifactRepository mavenArtifactRepository, String contextUrl, ArtifactoryClientConfiguration.ResolverHandler resolver) { mavenArtifactRepository.setName("artifactoryResolutionRepository"); mavenArtifactRepository.setUrl(contextUrl + resolver.getRepoKey()); - // Set credentials if provided String username = resolver.getUsername(); String password = resolver.getPassword(); @@ -67,6 +67,8 @@ public static void addArtifactoryResolutionRepositoryAction(MavenArtifactReposit credentials.setUsername(username); credentials.setPassword(password); }); + // Make the authentication preemptive + mavenArtifactRepository.authentication(authentications -> authentications.create("basic", BasicAuthentication.class)); } }