diff --git a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java index 53eb178..3e6dec1 100644 --- a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java +++ b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java @@ -969 +969,11 @@ - Files.copy(provider.getFile().toPath(), path, StandardCopyOption.REPLACE_EXISTING); + try { + Files.copy(provider.getFile().toPath(), path, StandardCopyOption.REPLACE_EXISTING); + } + catch (FileSystemException e) { + if (!e.getMessage().contains("The process cannot access the file because it is being used by another process.")) { + throw e; + } + else { + LOGGER.warn("File \"" + provider.getFile().toPath() + "\" could not be overwritten because it is open.", e); + } + }