Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MEAR-285] check return value from mkdirs #15

Merged
merged 1 commit into from Sep 26, 2020
Merged

[MEAR-285] check return value from mkdirs #15

merged 1 commit into from Sep 26, 2020

Conversation

elharo
Copy link
Contributor

@elharo elharo commented Sep 25, 2020

Copy link
Member

@hboutemy hboutemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea

@elharo elharo merged commit 95a50c7 into master Sep 26, 2020
@elharo elharo deleted the ear-285 branch September 26, 2020 12:34
@@ -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() )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

if ( !destinationFile.isDirectory() )
{
    if ( !destinationFile.mkdirs() )
    {
        throw new MojoExecutionException( "Error creating " + destinationFile );
    }
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. That's not the right place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elharo
Copy link
Contributor Author

elharo commented Oct 1, 2020 via email

@zzzLobster
Copy link
Contributor

I have raised a PR associated with the original issue.
Should I open a new one for it?

@elharo
Copy link
Contributor Author

elharo commented Oct 1, 2020 via email

@mabrarov
Copy link
Contributor

mabrarov commented Oct 1, 2020

@elharo, I discussed this issue with @zzzLobster and we decided that I'll take care of openning new bug.

At the moment I'm able to reproduce this issue on Windows 10 x64 and CentOS 7 x64 with https://github.com/mabrarov/dockerfile-test:

$ git clone --branch develop https://github.com/mabrarov/dockerfile-test.git && \
mvn -f dockerfile-test/pom.xml package -Dmaven-ear-plugin.version=3.1.0 -Ddocker.skip && \
mvn -f dockerfile-test/pom.xml package -Dmaven-ear-plugin.version=3.1.0 -Ddocker.skip
...
[INFO] --- maven-ear-plugin:3.1.0:ear (default-ear) @ ear ---
[INFO] Copying artifact [war:org.mabrarov.dockerfile-test:war:1.1.7-SNAPSHOT] to [org.mabrarov.dockerfile-test-war-1.1.7-SNAPSHOT.war]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for dockerfile-test 1.1.7-SNAPSHOT:
[INFO] 
[INFO] dockerfile-test .................................... SUCCESS [  1.728 s]
[INFO] war ................................................ SUCCESS [  3.652 s]
[INFO] ear ................................................ FAILURE [  0.371 s]
[INFO] base-image ......................................... SUCCESS [  2.297 s]
[INFO] hollow-image ....................................... SUCCESS [  1.152 s]
[INFO] app-image .......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.011 s (Wall Clock)
[INFO] Finished at: 2020-10-01T14:34:15+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:3.1.0:ear (default-ear) on project ear: Failed to create directory XXX...\dockerfile-test\ear\target\temp\org.mabrarov.dockerfile-test-war-1.1.7-SNAPSHOT.war -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :ear

I'm in the process of creation of integration test in maven-ear-plugin repository to reproduce this issue and to validate fix of @zzzLobster.

I believe I'll complete my actions within next 12-24 hrs.

@zzzLobster
Copy link
Contributor

@mabrarov , I have created the issue, just to push a new commit with the correct issue number in description.
Feel free to add any details.
https://issues.apache.org/jira/browse/MEAR-287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants