elharo opened a new issue, #558:
URL: https://github.com/apache/maven-jar-plugin/issues/558
## Bug
When the content directory does not exist and `forceCreation` is `false`,
`createArchive()` logs a warning "JAR will be empty - no content was marked for
inclusion!" but then proceeds to create an empty JAR file anyway.
## Location
`AbstractJarMojo.java:280-283`:
```java
if (!Files.exists(contentDirectory)) {
if (!forceCreation) {
getLog().warn("JAR will be empty - no content was marked for
inclusion!");
}
} else {
archiver.getArchiver().addDirectory(contentDirectory.toFile(),
getIncludes(), getExcludes());
}
```
## Problem
The warning message says the JAR "will be empty", implying the process will
stop, but execution continues and `archiver.createArchive()` at line 288 still
produces a JAR file. This is misleading — either:
- The method should abort early if there is no content, or
- The warning should say something like "Creating empty JAR — no content was
marked for inclusion" to accurately describe what happens.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]