Merge pull request #215 from dhs3000/patch-1

allow wildcards in groupId or artifactId
This commit is contained in:
Dale Wijnand 2018-03-06 13:49:58 +00:00 committed by GitHub
commit 4c5e1b926b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -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 '<exclusion/>' for %s. Dependency exclusion should have both 'org' and 'module' to comply with Maven POM's schema."
.format(m)

View File

@ -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)
}
}