Skip to content

Commit

Permalink
Make the resolution repository preemptive
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi committed Aug 20, 2024
1 parent 01b82cb commit 8e70dbb
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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));
}
}

Expand Down

0 comments on commit 8e70dbb

Please sign in to comment.