mirror of https://github.com/sbt/sbt.git
Fix #1136 - Ivy's `+` dependencies not converted to maven style syntax.
* Attempt to convert dependencies that end in `+` into maven-style version range * if a failure occurs, just use the original version (could be bad...).
This commit is contained in:
parent
c43d4fbcf4
commit
b25fc2bd00
|
|
@ -188,7 +188,7 @@ class MakePom(val log: Logger)
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>{mrid.getOrganisation}</groupId>
|
<groupId>{mrid.getOrganisation}</groupId>
|
||||||
<artifactId>{mrid.getName}</artifactId>
|
<artifactId>{mrid.getName}</artifactId>
|
||||||
<version>{mrid.getRevision}</version>
|
<version>{makeDependencyVersion(mrid.getRevision)}</version>
|
||||||
{ scopeElem(scope) }
|
{ scopeElem(scope) }
|
||||||
{ optionalElem(optional) }
|
{ optionalElem(optional) }
|
||||||
{ classifierElem(classifier) }
|
{ classifierElem(classifier) }
|
||||||
|
|
@ -197,6 +197,25 @@ class MakePom(val log: Logger)
|
||||||
</dependency>
|
</dependency>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def makeDependencyVersion(revision: String): String = {
|
||||||
|
if(revision endsWith "+") try {
|
||||||
|
// TODO - this is the slowest possible implementation.
|
||||||
|
val beforePlus = revision.reverse.dropWhile(_ != '.').drop(1).reverse
|
||||||
|
val lastVersion = beforePlus.reverse.takeWhile(_ != '.').reverse
|
||||||
|
val lastVersionInt = lastVersion.toInt
|
||||||
|
val prefixVersion = beforePlus.reverse.dropWhile(_ != '.').drop(1).reverse
|
||||||
|
s"[$beforePlus, ${prefixVersion}.${lastVersionInt+1})"
|
||||||
|
} catch {
|
||||||
|
case e: NumberFormatException =>
|
||||||
|
// TODO - if the version deosn't meet our expectations, maybe we just issue a hard
|
||||||
|
// error instead of softly ignoring the attempt to rewrite.
|
||||||
|
//sys.error(s"Could not fix version [$revision] into maven style version")
|
||||||
|
revision
|
||||||
|
} else revision
|
||||||
|
}
|
||||||
|
|
||||||
@deprecated("No longer used and will be removed.", "0.12.1")
|
@deprecated("No longer used and will be removed.", "0.12.1")
|
||||||
def classifier(dependency: DependencyDescriptor, includeTypes: Set[String]): NodeSeq =
|
def classifier(dependency: DependencyDescriptor, includeTypes: Set[String]): NodeSeq =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue