From dd9e3265031fc318066935417182dac4f84fde67 Mon Sep 17 00:00:00 2001 From: Adrien Piquerez Date: Mon, 7 Oct 2024 15:41:15 +0200 Subject: [PATCH 1/2] Exclude custom extra from POM dependency --- .../PomExtraDependencyAttributes.scala | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala index 25ab896b..4160b600 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala @@ -78,9 +78,7 @@ object PomExtraDependencyAttributes { item.getQualifiedExtraAttributes.asInstanceOf[java.util.Map[String, String]].asScala.toMap } def filterCustomExtra(item: ExtendableItem, include: Boolean): Map[String, String] = - (qualifiedExtra(item) filterKeys { k => - qualifiedIsExtra(k) == include - }).toMap + qualifiedExtra(item).filterKeys { k => qualifiedIsExtra(k) == include }.toMap def qualifiedIsExtra(k: String): Boolean = k.endsWith(ScalaVersionKey) || k.endsWith(SbtVersionKey) @@ -107,17 +105,27 @@ object PomExtraDependencyAttributes { /** * Creates the "extra" property values for DependencyDescriptors that can be written into a maven pom - * so we don't loose the information. + * so we don't lose the information. * @param s * @return */ def writeDependencyExtra(s: Seq[DependencyDescriptor]): Seq[String] = s.flatMap { dd => val revId = dd.getDependencyRevisionId - if (filterCustomExtra(revId, include = true).isEmpty) + val filteredExtra = filterCustomExtra(revId, include = true) + if (filteredExtra.isEmpty) Nil - else - revId.encodeToString :: Nil + else { + import scala.collection.JavaConverters._ + val revId0 = ModuleRevisionId.newInstance( + revId.getOrganisation, + revId.getName, + revId.getBranch, + revId.getRevision, + filteredExtra.asJava + ) + revId0.encodeToString :: Nil + } } } From a4d2b9c03bac2a8167ccab9d3a0e31ddfcf2987a Mon Sep 17 00:00:00 2001 From: Adrien Piquerez Date: Mon, 7 Oct 2024 15:41:25 +0200 Subject: [PATCH 2/2] Fix ModuleResolversTest --- .../internal/librarymanagement/ModuleResolversTest.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/ModuleResolversTest.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/ModuleResolversTest.scala index 96f4c5b2..94c30d24 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/ModuleResolversTest.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/ModuleResolversTest.scala @@ -3,13 +3,13 @@ package sbt.internal.librarymanagement import sbt.librarymanagement._ import sbt.librarymanagement.syntax._ import sbt.librarymanagement.ivy.UpdateOptions -import Resolver._ object ModuleResolversTest extends BaseIvySpecification { override final val resolvers = Vector( - DefaultMavenRepository, - JavaNet2Repository, - JCenterRepository, + MavenRepository( + "JFrog OSS Releases", + "https://releases.jfrog.io/artifactory/oss-releases/" + ), Resolver.sbtPluginRepo("releases") )