From 304c4b3d3b6dc190b914798c86632fa118004c04 Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Fri, 2 Oct 2020 20:25:49 +0300 Subject: [PATCH] [MEAR-287] - Refactoring of logging when modifying manifest of EAR modules --- .../org/apache/maven/plugins/ear/EarMojo.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java index d28efa3a..3e4ef05d 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java +++ b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java @@ -749,19 +749,21 @@ private void changeManifestClasspath( EarModule module, File original, JavaEEVer // Create a temporary work directory // MEAR-167 use uri as directory to prevent merging of artifacts with the same artifactId workDirectory = new File( new File( getTempFolder(), "temp" ), module.getUri() ); - if ( workDirectory.isDirectory() || workDirectory.mkdirs() ) + if ( !workDirectory.isDirectory() ) { - getLog().debug( "Created a temporary work directory: " + workDirectory.getAbsolutePath() ); - - // Unpack the archive to a temporary work directory - zipUnArchiver.setSourceFile( original ); - zipUnArchiver.setDestDirectory( workDirectory ); - zipUnArchiver.extract(); - } - else - { - throw new MojoFailureException( "Failed to create directory " + workDirectory ); + if ( workDirectory.mkdirs() ) + { + getLog().debug( "Created a temporary work directory: " + workDirectory.getAbsolutePath() ); + } + else + { + throw new MojoFailureException( "Failed to create directory " + workDirectory ); + } } + // Unpack the archive to a temporary work directory + zipUnArchiver.setSourceFile( original ); + zipUnArchiver.setDestDirectory( workDirectory ); + zipUnArchiver.extract(); } else {