diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-08 18:29:21 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-08 18:30:06 -0400 |
commit | 0f8fcb91a28d931131c7f876c7d73f9bb837b4fe (patch) | |
tree | 2d089d5ac99494ad2d4e5c7f81abdf7e177906b1 /stage1/resolver.scala | |
parent | 5fdfbf662cad2b00ed68729318dbb3a7e3c67ba3 (diff) | |
download | cbt-0f8fcb91a28d931131c7f876c7d73f9bb837b4fe.tar.gz cbt-0f8fcb91a28d931131c7f876c7d73f9bb837b4fe.tar.bz2 cbt-0f8fcb91a28d931131c7f876c7d73f9bb837b4fe.zip |
Allow substituting POM variables inside of strings, not only entire elements
Diffstat (limited to 'stage1/resolver.scala')
-rw-r--r-- | stage1/resolver.scala | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/stage1/resolver.scala b/stage1/resolver.scala index e4af8a9..694bd83 100644 --- a/stage1/resolver.scala +++ b/stage1/resolver.scala @@ -402,10 +402,12 @@ case class BoundMavenDependency( def lookup( xml: Node, accessor: Node => NodeSeq ): Option[String] = { //println("lookup in "++pomUrl) val Substitution = "\\$\\{([^\\}]+)\\}".r - accessor(xml).headOption.flatMap{v => + accessor(xml).headOption.map{v => //println("found: "++v.text) - v.text match { - case Substitution(path) => Option( + Substitution.replaceAllIn( + v.text, + matcher => { + val path = matcher.group(1) properties.get(path).orElse( transitivePom.reverse.flatMap{ d => Some(path.split("\\.").toList).collect{ @@ -414,10 +416,12 @@ case class BoundMavenDependency( }.filter(_ != "") }.headOption ) - .getOrElse( throw new Exception(s"Can't find $path in \n$properties.\n\npomParents: $transitivePom\n\n pomXml:\n$pomXml" ))) - //println("lookup "++path ++ ": "++(pomXml\path).text) - case value => Option(value) - } + .getOrElse( + throw new Exception(s"Can't find $path in \n$properties.\n\npomParents: $transitivePom\n\n pomXml:\n$pomXml" ) + ) + //println("lookup "++path ++ ": "++(pomXml\path).text) + } + ) } } } |