@Test public void packageJarNameWithVersion() { String jarName = "org.camunda.bpm.bar.foo-1.100.1001.jar"; String[] strings = NameVersionTypeExtractor .extractNameVersionType(jarName); checkStrings(strings, "org.camunda.bpm.bar.foo", "1.100.1001" ,"jar"); }
public static String[] extractNameVersionType(String jarName) { Matcher m = ARTIFACT_MATCHER.matcher(jarName); if (!m.matches()) { m = SIMPLE_FILENAME_MATCHER.matcher(jarName); if(m.matches()) { return new String[] { m.group(1), DEFAULT_VERSION, m.group(2) }; } return new String[] { jarName, DEFAULT_VERSION }; } StringBuffer v = new StringBuffer(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); String d4 = m.group(4); String d5 = m.group(5); String d6 = m.group(6); if (d2 != null) { v.append(d2); if (d3 != null) { v.append('.'); v.append(d3); if (d4 != null) { v.append('.'); v.append(d4); if (d5 != null) { v.append("."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0.0."); cleanupModifier(v, d5); } } return new String[] { d1, v.toString(), d6 }; }
NameVersionTypeExtractor { public static String[] extractNameVersionType(String jarName) { Matcher m = ARTIFACT_MATCHER.matcher(jarName); if (!m.matches()) { m = SIMPLE_FILENAME_MATCHER.matcher(jarName); if(m.matches()) { return new String[] { m.group(1), DEFAULT_VERSION, m.group(2) }; } return new String[] { jarName, DEFAULT_VERSION }; } StringBuffer v = new StringBuffer(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); String d4 = m.group(4); String d5 = m.group(5); String d6 = m.group(6); if (d2 != null) { v.append(d2); if (d3 != null) { v.append('.'); v.append(d3); if (d4 != null) { v.append('.'); v.append(d4); if (d5 != null) { v.append("."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0.0."); cleanupModifier(v, d5); } } return new String[] { d1, v.toString(), d6 }; } }
NameVersionTypeExtractor { public static String[] extractNameVersionType(String jarName) { Matcher m = ARTIFACT_MATCHER.matcher(jarName); if (!m.matches()) { m = SIMPLE_FILENAME_MATCHER.matcher(jarName); if(m.matches()) { return new String[] { m.group(1), DEFAULT_VERSION, m.group(2) }; } return new String[] { jarName, DEFAULT_VERSION }; } StringBuffer v = new StringBuffer(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); String d4 = m.group(4); String d5 = m.group(5); String d6 = m.group(6); if (d2 != null) { v.append(d2); if (d3 != null) { v.append('.'); v.append(d3); if (d4 != null) { v.append('.'); v.append(d4); if (d5 != null) { v.append("."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0.0."); cleanupModifier(v, d5); } } return new String[] { d1, v.toString(), d6 }; }  }
NameVersionTypeExtractor { public static String[] extractNameVersionType(String jarName) { Matcher m = ARTIFACT_MATCHER.matcher(jarName); if (!m.matches()) { m = SIMPLE_FILENAME_MATCHER.matcher(jarName); if(m.matches()) { return new String[] { m.group(1), DEFAULT_VERSION, m.group(2) }; } return new String[] { jarName, DEFAULT_VERSION }; } StringBuffer v = new StringBuffer(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); String d4 = m.group(4); String d5 = m.group(5); String d6 = m.group(6); if (d2 != null) { v.append(d2); if (d3 != null) { v.append('.'); v.append(d3); if (d4 != null) { v.append('.'); v.append(d4); if (d5 != null) { v.append("."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0.0."); cleanupModifier(v, d5); } } return new String[] { d1, v.toString(), d6 }; }  static String[] extractNameVersionType(String jarName); }
NameVersionTypeExtractor { public static String[] extractNameVersionType(String jarName) { Matcher m = ARTIFACT_MATCHER.matcher(jarName); if (!m.matches()) { m = SIMPLE_FILENAME_MATCHER.matcher(jarName); if(m.matches()) { return new String[] { m.group(1), DEFAULT_VERSION, m.group(2) }; } return new String[] { jarName, DEFAULT_VERSION }; } StringBuffer v = new StringBuffer(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); String d4 = m.group(4); String d5 = m.group(5); String d6 = m.group(6); if (d2 != null) { v.append(d2); if (d3 != null) { v.append('.'); v.append(d3); if (d4 != null) { v.append('.'); v.append(d4); if (d5 != null) { v.append("."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0.0."); cleanupModifier(v, d5); } } return new String[] { d1, v.toString(), d6 }; }  static String[] extractNameVersionType(String jarName);  }