From 0f8fcb91a28d931131c7f876c7d73f9bb837b4fe Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Fri, 8 Apr 2016 18:29:21 -0400 Subject: Allow substituting POM variables inside of strings, not only entire elements --- stage1/resolver.scala | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'stage1/resolver.scala') 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) + } + ) } } } -- cgit v1.2.3