You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2025/11/24 13:51:35 UTC
[I] mkdirs retrun value is ignored [maven-war-plugin]
elharo opened a new issue, #590:
URL: https://github.com/apache/maven-war-plugin/issues/590
### Affected version
HEAD
### Bug description
There is a lot of code scattered throughout the project where we do things like
metainfDir.mkdirs();
without checking if the operation succeeded. Depending on context this can result in a harder to diagnose exception further down the line, or a war file that is simply missing things it should have. Either way we should check the results of these operations and throw the available mojo exception earlier.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] mkdirs return value is ignored [maven-war-plugin]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on issue #590:
URL: https://github.com/apache/maven-war-plugin/issues/590#issuecomment-4876449199
no permission is needed. Just send a PR and I'll review it
--
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.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] mkdirs return value is ignored [maven-war-plugin]
Posted by "HarshMehta112 (via GitHub)" <gi...@apache.org>.
HarshMehta112 commented on issue #590:
URL: https://github.com/apache/maven-war-plugin/issues/590#issuecomment-3591825797
@elharo I got your point. We need to add proper checks around all mkdir()/mkdirs() calls and throw a MojoExecutionException when directory creation fails, ensuring early and clear error reporting instead of harder-to-diagnose issues later or incomplete WAR files. The changes remain consistent across the plugin and do not affect existing functionality.
Replace calls like `metainfDir.mkdirs();` with explicit checks:
```java
if (!metainfDir.exists() && !metainfDir.mkdirs()) {
throw new MojoExecutionException(
"Failed to create directory: " + metainfDir.getAbsolutePath());
}
```
Let me know if I can proceed with a PR. Thanks!
--
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.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org