Ignore JARs of relocated dependencies

This commit is contained in:
Alexandre Archambault 2017-05-05 18:04:20 +02:00
parent 1113555ed7
commit ef3d8c06a5
6 changed files with 25 additions and 7 deletions

View File

@ -89,7 +89,6 @@ final case class Project(
*/
actualVersionOpt: Option[String],
// Ivy-specific
// First String is configuration
publications: Seq[(String, Publication)],

View File

@ -328,6 +328,7 @@ final case class MavenRepository(
val prefix = s"${module.name}-${versioningValue.getOrElse(version)}"
val packagingTpeMap = proj0.packagingOpt
.filter(_ != Pom.relocatedPackaging)
.map { packaging =>
(MavenSource.typeDefaultClassifier(packaging), MavenSource.typeExtension(packaging)) -> packaging
}

View File

@ -228,13 +228,13 @@ final case class MavenSource(
dependency: Dependency,
project: Project,
overrideClassifiers: Option[Seq[String]]
): Seq[Artifact] = {
if (project.publications.isEmpty)
): Seq[Artifact] =
if (project.packagingOpt.toSeq.contains(Pom.relocatedPackaging))
Nil
else if (project.publications.isEmpty)
artifactsUnknownPublications(dependency, project, overrideClassifiers)
else
artifactsKnownPublications(dependency, project, overrideClassifiers)
}
}
object MavenSource {

View File

@ -296,7 +296,7 @@ object Pom {
profiles,
None,
None,
packagingOpt(pom),
relocationDependencyOpt.fold(packagingOpt(pom))(_ => Some(relocatedPackaging)),
None,
Nil,
Info(
@ -445,6 +445,8 @@ object Pom {
)
}
val relocatedPackaging = s"$$relocated"
val extraAttributeSeparator = ":#@#:"
val extraAttributePrefix = "+"

View File

@ -0,0 +1,2 @@
commons-io:commons-io:1.3.2:compile
org.apache.commons:commons-io:1.3.2:compile

View File

@ -588,10 +588,24 @@ object CentralTests extends TestSuite {
}
'relocation - {
resolutionCheck(
* - resolutionCheck(
Module("bouncycastle", "bctsp-jdk14"),
"138"
)
'ignoreRelocationJars - {
val mod = Module("org.apache.commons", "commons-io")
val ver = "1.3.2"
val expectedUrl = "https://repo1.maven.org/maven2/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar"
* - resolutionCheck(mod, ver)
* - withArtifacts(mod, ver, "jar", transitive = true) { artifacts =>
assert(artifacts.length == 1)
assert(artifacts.head.url == expectedUrl)
}
}
}
}