1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00
This commit is contained in:
Cedric Beust 2015-10-29 20:12:42 -07:00
parent b9ba951c3c
commit 07da07bb6d

View file

@ -1,5 +1,15 @@
package com.beust.kobalt.maven
/**
* Encapsulate a Maven id captured in one string, as used by Gradle or Ivy, e.g. "org.testng:testng:6.9.9".
* These id's are somewhat painful to manipulate because on top of containing groupId, artifactId
* and version, they also accept an optional packaging (e.g. "aar") and qualifier (e.g. "no_aop").
* Determining which is which in an untyped string separated by colons is not clearly defined so
* this class does a best attempt at deconstructing an id but there's surely room for improvement.
*
* This class accepts a versionless id, which needs to end with a :, e.g. "com.beust:jcommander:" (which
* usually means "latest version") but it doesn't handle version ranges yet.
*/
public class MavenId(val id: String) {
lateinit var groupId: String
lateinit var artifactId: String
@ -33,7 +43,7 @@ public class MavenId(val id: String) {
}
}
private fun isVersion(s: String) : Boolean = Character.isDigit(s.get(0))
private fun isVersion(s: String) : Boolean = Character.isDigit(s[0])
val hasVersion = version != null