You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/10/01 08:45:04 UTC

[GitHub] [maven-ear-plugin] zzzLobster commented on a change in pull request #15: [MEAR-285] check return value from mkdirs

zzzLobster commented on a change in pull request #15:
URL: https://github.com/apache/maven-ear-plugin/pull/15#discussion_r498081406



##########
File path: src/main/java/org/apache/maven/plugins/ear/EarMojo.java
##########
@@ -453,7 +453,10 @@ private void copyModules( final JavaEEVersion javaEEVersion,
                 {
                     getLog().info( "Copying artifact [" + module + "] to [" + module.getUri() + "] (unpacked)" );
                     // Make sure that the destination is a directory to avoid plexus nasty stuff :)
-                    destinationFile.mkdirs();
+                    if ( !destinationFile.mkdirs() )

Review comment:
       This change seems to be causing an issue when build is run without "clean".
   `[INFO] Copying artifact [ejb:com.aaa.bbb:bbb-ejb:1.0.0.0-SNAPSHOT] to [bbb-ejb.jar]`
   `[ERROR] Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:3.1.0:ear (default-ear) on project bbb-ear: Failed to create directory /Checkout/project/bbb/bbb-ear/target/temp/bbb-ejb.jar -> [Help 1]`
   
   Probably it should be wrapped with something like:
   ```java
   if ( !destinationFile.isDirectory() )
   {
       if ( !destinationFile.mkdirs() )
       {
           throw new MojoExecutionException( "Error creating " + destinationFile );
       }
   }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org