From 504233e99b7f852ca85d327d5210e6bdd7bd7f78 Mon Sep 17 00:00:00 2001 From: "Jack C. Viers" Date: Sun, 4 Feb 2024 22:06:35 -0600 Subject: [PATCH] Addresses https://github.com/com-lihaoyi/mill/pull/2954#discussion_r1469474916 --- .../src/mill/scalalib/coursier/CoursierWorkerModule.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scalalib/src/mill/scalalib/coursier/CoursierWorkerModule.scala b/scalalib/src/mill/scalalib/coursier/CoursierWorkerModule.scala index a3688bd37a8..5cc57f658dc 100644 --- a/scalalib/src/mill/scalalib/coursier/CoursierWorkerModule.scala +++ b/scalalib/src/mill/scalalib/coursier/CoursierWorkerModule.scala @@ -51,8 +51,7 @@ trait CoursierWorkerModule { } /** - * Sets up repositories with mirrors, proxies, and credentials from - * coursier's config sources. + * Sets up repositories with mirrors, proxies, and credentials from coursier's config sources, without overwriting existing authentication. * * @return a worker containing the result of applying the coursier credentials, proxy setup, and mirrors to the repositories in coursiers configs */ @@ -64,18 +63,19 @@ trait CoursierWorkerModule { Await.result( Resolve().finalRepositories.map { _.map { - case x: IvyRepository => + case x: IvyRepository if x.authentication.isEmpty => x.withAuthentication( resolvedCredentials.find { c => c.matches(x.pattern.string, c.usernameOpt.getOrElse("")) }.map(_.authentication) ) - case x: MavenRepository => + case x: MavenRepository if x.authentication.isEmpty => x.withAuthentication( resolvedCredentials.find { c => c.matches(x.root, c.usernameOpt.getOrElse("")) }.map(_.authentication) ) + case r => r } }.future(), Duration.Inf