Bug
When both skipIfEmpty=true and forceCreation=true are set, forceCreation has no effect. The execute() method checks skipIfEmpty first and returns early without calling createArchive(), even though the user explicitly requested forced creation.
Location
AbstractJarMojo.java:303-306:
public void execute() throws MojoException {
if (skipIfEmpty && isEmpty(getClassesDirectory())) {
getLog().info(String.format("Skipping packaging of the %s.", getType()));
} else {
...
}
}
Problem
If a user configures both skipIfEmpty=true and forceCreation=true, the intent is presumably: "skip if empty, unless force is requested." However, skipIfEmpty always takes priority. forceCreation is only evaluated inside createArchive() which is never reached when the content directory is empty.
The @Parameter documentation for forceCreation (lines 114-124) describes it as forcing recreation of the JAR even if inputs have not changed. A user might reasonably expect that forceCreation=true would override skipIfEmpty=true and still produce the JAR.
Suggested fix
The execute() method should only skip when both skipIfEmpty=true and forceCreation=false, i.e.:
if (skipIfEmpty && !forceCreation && isEmpty(getClassesDirectory())) {
Bug
When both
skipIfEmpty=trueandforceCreation=trueare set,forceCreationhas no effect. Theexecute()method checksskipIfEmptyfirst and returns early without callingcreateArchive(), even though the user explicitly requested forced creation.Location
AbstractJarMojo.java:303-306:Problem
If a user configures both
skipIfEmpty=trueandforceCreation=true, the intent is presumably: "skip if empty, unless force is requested." However,skipIfEmptyalways takes priority.forceCreationis only evaluated insidecreateArchive()which is never reached when the content directory is empty.The
@Parameterdocumentation forforceCreation(lines 114-124) describes it as forcing recreation of the JAR even if inputs have not changed. A user might reasonably expect thatforceCreation=truewould overrideskipIfEmpty=trueand still produce the JAR.Suggested fix
The
execute()method should only skip when bothskipIfEmpty=trueandforceCreation=false, i.e.: