Fix issue when artifact name contains a '-'.
[lgpl/argeo-commons.git] / org.argeo.osgi.boot / src / org / argeo / osgi / boot / a2 / FsA2Source.java
index 6fc25c1127f98d8adf93d390b6e072d99ae15b8f..c0e721941b1a82c8385d43c7dba170b1e5b5490e 100644 (file)
@@ -43,9 +43,11 @@ public class FsA2Source extends ProvisioningSource {
                                        if (!"jar".equals(ext))
                                                continue modules;
                                        String moduleName = moduleFileName.substring(0, lastDot);
-                                       int firstDash = moduleName.indexOf('-');
-                                       String versionStr = moduleName.substring(firstDash + 1);
-                                       String componentName = moduleName.substring(0, firstDash);
+                                       if (moduleName.endsWith("-SNAPSHOT"))
+                                               moduleName = moduleName.substring(0, moduleName.length() - "-SNAPSHOT".length());
+                                       int lastDash = moduleName.lastIndexOf('-');
+                                       String versionStr = moduleName.substring(lastDash + 1);
+                                       String componentName = moduleName.substring(0, lastDash);
                                        // if(versionStr.endsWith("-SNAPSHOT")) {
                                        // versionStr = readVersionFromModule(modulePath);
                                        // }