1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 16:48:12 -07:00

MavenId fixes.

This commit is contained in:
Cedric Beust 2015-10-28 22:20:34 -07:00
parent e252a5386c
commit 54f9dde73d
2 changed files with 43 additions and 2 deletions

View file

@ -23,10 +23,18 @@ public class MavenId(val id: String) {
}
groupId = c[0]
artifactId = c[1]
packaging = if (c.size == 4) c[2] else null
version = if (c.size == 4) c[3] else if (c.size == 3 && ! c[2].isBlank()) c[2] else null
if (! c[2].isEmpty()) {
if (isVersion(c[2])) {
version = c[2]
} else {
packaging = c[2]
version = c[3]
}
}
}
private fun isVersion(s: String) : Boolean = Character.isDigit(s.get(0))
val hasVersion = version != null
val toId = MavenId.toId(groupId, artifactId, packaging, version)