Deal with jars without symbolic name
[cc0/argeo-build.git] / src / org / argeo / build / Repackage.java
index b594f3a19b44e4aff5ee3d62a772e845a8928225..442e7e0d40952d979e5432a0499fc2ec86eb2e4c 100644 (file)
@@ -119,6 +119,8 @@ public class Repackage {
        /** Deletes remaining sub directories. */
        void cleanPreviousFailedBuild(Path categoryPath) {
                Path outputCategoryPath = a2Base.resolve(categoryPath);
+               if (!Files.exists(outputCategoryPath))
+                       return;
                // clean previous failed build
                try {
                        for (Path subDir : Files.newDirectoryStream(outputCategoryPath, (d) -> Files.isDirectory(d))) {
@@ -932,6 +934,8 @@ public class Repackage {
                                                                        map.put(key.toString(), commonProps.getProperty(key.toString()));
                                                                A2Origin origin = new A2Origin();
                                                                Path bundleDir = processBundleJar(file, targetCategoryBase, map, origin);
+                                                               if (bundleDir == null)
+                                                                       return FileVisitResult.CONTINUE;
                                                                origins.put(bundleDir, origin);
                                                                logger.log(DEBUG, () -> "Processed " + file);
                                                        }
@@ -1037,6 +1041,10 @@ public class Repackage {
                                nameVersion = new NameVersion(ourSymbolicName, ourVersion);
                        } else {
                                nameVersion = nameVersionFromManifest(manifest);
+                               if (nameVersion == null) {
+                                       logger.log(WARNING, file + " has no symbolic name, skipping...");
+                                       return null;
+                               }
                                if (ourVersion != null && !nameVersion.getVersion().equals(ourVersion)) {
                                        logger.log(WARNING,
                                                        "Original version is " + nameVersion.getVersion() + " while new version is " + ourVersion);