Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add post pom processor to make sure that casbah dependency in pom gen…

…erated for salat-core specifies type "pom" - otherwise sbt is fine but Maven proper will fail with an error trying to download a jar for an aggregator pom.
  • Loading branch information...
commit 1ac5819a18afd52567c1763d273230632c6a9a19 1 parent 7a62537
@rktoomey rktoomey authored
Showing with 32 additions and 1 deletion.
  1. +32 −1 project/SalatBuild.scala
View
33 project/SalatBuild.scala
@@ -103,6 +103,10 @@ object Publish {
pomIncludeRepository := { _ => false },
licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
homepage := Some(url("https://github.com/novus/salat")),
+ pomPostProcess := {
+ (pomXML: scala.xml.Node) =>
+ PomPostProcessor(pomXML)
+ },
pomExtra := (
<scm>
<url>git://github.com/novus/salat.git</url>
@@ -118,13 +122,40 @@ object Publish {
)
}
+object PomPostProcessor {
+ import scala.xml._
+
+ // see https://groups.google.com/d/topic/simple-build-tool/pox4BwWshtg/discussion
+ // adding a post pom processor to make sure that pom for salat-core correctly specifies depdency type pom for casbah dependency
+
+ def apply(pomXML: Node): Node = {
+ def rewrite(pf: PartialFunction[Node, Node])(ns: Seq[Node]): Seq[Node] = for (subnode <- ns) yield subnode match {
+ case e: Elem =>
+ if (pf isDefinedAt e) pf(e)
+ else Elem(e.prefix, e.label, e.attributes, e.scope, rewrite(pf)(e.child): _*)
+ case other => other
+ }
+
+ val rule: PartialFunction[Node, Node] = {
+ case e @ Elem(prefix, "dependency", attribs, scope, children @ _*) => {
+ if (children.contains(<groupId>org.mongodb</groupId>)) {
+ Elem(prefix, "dependency", attribs, scope, children ++ <type>pom</type>: _*)
+ }
+ else e
+ }
+ }
+
+ rewrite(rule)(pomXML.theSeq)(0)
+ }
+}
+
object Dependencies {
val specs2 = "org.specs2" %% "specs2" % "1.11" % "test"
val commonsLang = "commons-lang" % "commons-lang" % "2.5" % "test"
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.6.4"
val logbackCore = "ch.qos.logback" % "logback-core" % "1.0.0" % "test"
val logbackClassic = "ch.qos.logback" % "logback-classic" % "1.0.0" % "test"
- val casbah = "org.mongodb" %% "casbah" % "2.4.1"
+ val casbah = "org.mongodb" %% "casbah" % "2.4.1" artifacts( Artifact("casbah", "pom", "pom") )
val lift_json = "net.liftweb" %% "lift-json" % "2.5-SNAPSHOT"
}
Please sign in to comment.
Something went wrong with that request. Please try again.