Skip to content

Commit aeb9ef9

Browse files
authored
If arhive already exists with same name just delete it before creating new (#245)
Signed-off-by: Olivier Lamy <olamy@apache.org>
1 parent 1876c8c commit aeb9ef9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

jetty-embedded-12-1-ee11/src/main/java/org/jboss/arquillian/container/jetty/embedded_12_1_ee11/ArquillianAppProvider.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ protected WebAppContext createWebAppContext(final Archive<?> archive) {
9898
final File exported;
9999
try {
100100
if (this.config.isUseArchiveNameAsContext()) {
101-
exported = Files.createFile(EXPORT_DIR.toPath().resolve(archive.getName())).toFile();
101+
Path war = EXPORT_DIR.toPath().resolve(archive.getName());
102+
if(Files.exists(war)) {
103+
LOG.warning("File already exists: " + war + ". Removing it.");
104+
Files.deleteIfExists(war);
105+
}
106+
exported = Files.createFile(war).toFile();
102107
exported.deleteOnExit();
103108
} else {
104109
// If this method returns successfully then it is guaranteed that:

0 commit comments

Comments
 (0)