* Convert the maven version into OSGi version
* @param mavenVersion
* @return
*/
static String osgiVersion(String mavenVersion) {
ArtifactVersion ver = new DefaultArtifactVersion(mavenVersion);
String qualifer = ver.getQualifier();
if (qualifer != null) {
StringBuffer buf = new StringBuffer(qualifer);
for (int i = 0; i < buf.length(); i++) {
char c = buf.charAt(i);
if (Character.isLetterOrDigit(c) || c == '-' || c == '_') {
// Keep as-is
} else {
buf.setCharAt(i, '_');
}
}
qualifer = buf.toString();
}
Version osgiVersion =
new Version(ver.getMajorVersion(), ver.getMinorVersion(), ver.getIncrementalVersion(), qualifer);
String version = osgiVersion.toString();
return version;
}