From c9e4ace8dee2b0e4a2eec5b4daba73d71e7f543d Mon Sep 17 00:00:00 2001 From: Dennis Hoersch Date: Fri, 2 Mar 2018 19:54:02 +0100 Subject: [PATCH 1/2] allow wildcards in groupId or artifactId According to https://maven.apache.org/pom.html#Exclusions (and https://maven.apache.org/docs/3.2.1/release-notes.html) wildcards are allowed in Maven POM's schema --- ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala index 3ec739e48..f91589c9d 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala @@ -425,7 +425,7 @@ class MakePom(val log: Logger) { def makeExclusion(exclRule: ExcludeRule): Either[String, NodeSeq] = { val m = exclRule.getId.getModuleId val (g, a) = (m.getOrganisation, m.getName) - if (g == null || g.isEmpty || g == "*" || a.isEmpty || a == "*") + if (g == null || g.isEmpty || a == null || a.isEmpty) Left( "Skipped generating '' for %s. Dependency exclusion should have both 'org' and 'module' to comply with Maven POM's schema." .format(m) From 245997c84ee4f05c73d7f60fe5edc4ad476a4ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20H=C3=B6rsch?= Date: Sat, 3 Mar 2018 13:31:26 +0100 Subject: [PATCH 2/2] Added test for wildcards in org and name --- ivy/src/test/scala/InclExclSpec.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ivy/src/test/scala/InclExclSpec.scala b/ivy/src/test/scala/InclExclSpec.scala index 62856f0c1..076e22b27 100644 --- a/ivy/src/test/scala/InclExclSpec.scala +++ b/ivy/src/test/scala/InclExclSpec.scala @@ -27,6 +27,13 @@ class InclExclSpec extends BaseIvySpecification { ) } + def testScalaLibraryIsMissing(report: UpdateReport): Assertion = { + assert( + !report.allModules.exists(_.name.contains("scala-library")), + "scala-library has not been excluded." + ) + } + def testScalahostIsMissing(report: UpdateReport): Assertion = { assert( !report.allModules.exists(_.name.contains("scalahost")), @@ -65,4 +72,16 @@ class InclExclSpec extends BaseIvySpecification { val report = getIvyReport(createMetaDep(excluded), scala2122) testScalahostIsMissing(report) } + + it should "exclude any version of scala-library via * artifact id" in { + val toExclude = ExclusionRule("org.scala-lang", "*") + val report = getIvyReport(createLiftDep(toExclude), scala210) + testScalaLibraryIsMissing(report) + } + + it should "exclude any version of scala-library via * org id" in { + val toExclude = ExclusionRule("*", "scala-library") + val report = getIvyReport(createLiftDep(toExclude), scala210) + testScalaLibraryIsMissing(report) + } }