mirror of https://github.com/sbt/sbt.git
'makePom' should not generate <type> elements for standard classifiers. Fixes #728.
The <type> element was generated for any explicit Artifact with a type other than "jar". withSources() and withJavadoc() create explicit Artifacts of this kind, but shouldn't have <type> elements. They are primarily artifacts with classifiers- the type is an Ivy aspect. So, when writing to a pom, don't use write a type for known classifiers.
This commit is contained in:
parent
4958c98e52
commit
77ed899a96
|
|
@ -174,7 +174,13 @@ class MakePom(val log: Logger)
|
|||
case x => x.toArray
|
||||
}
|
||||
val (scope, optional) = getScopeAndOptional(configs)
|
||||
makeDependencyElem(dependency, scope, optional, artifactClassifier(artifact), artifactType(artifact))
|
||||
val classifier = artifactClassifier(artifact)
|
||||
val baseType = artifactType(artifact)
|
||||
val tpe = (classifier, baseType) match {
|
||||
case (Some(c), Some(tpe)) if Artifact.classifierType(c) == tpe => None
|
||||
case _ => baseType
|
||||
}
|
||||
makeDependencyElem(dependency, scope, optional, classifier, tpe)
|
||||
}
|
||||
def makeDependencyElem(dependency: DependencyDescriptor, scope: Option[String], optional: Boolean, classifier: Option[String], tpe: Option[String]): Elem =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
scalaVersion := "2.10.2"
|
||||
|
||||
libraryDependencies += "org.scala-sbt" %% "sbinary" % "0.4.1" withSources() withJavadoc()
|
||||
|
||||
lazy val checkPom = taskKey[Unit]("check pom to ensure no <type> sections are generated")
|
||||
|
||||
checkPom := {
|
||||
val pomFile = makePom.value
|
||||
val pom = xml.XML.loadFile(pomFile)
|
||||
val tpe = pom \\ "type"
|
||||
if(!tpe.isEmpty)
|
||||
error("Expected no <type> sections, got: " + tpe + " in \n\n" + pom)
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
> checkPom
|
||||
Loading…
Reference in New Issue