Quarkus aggregate configurations from different executions that share the same goal #35831
Description
Describe the bug
After we get this issue raised on jaxb-maven-plugin (former highsource's maven-jaxb2-plugin) and analysis, it seems that quarkus does some strange aggregation over all executions of the plugin that shares the same goal but with different ids.
This behaviour shouldn't be active when the executions ids differs (both are defined and not equals).
By doing it, it's making the plugin receive mixed an incompatible configuration and, even if both executions are run, the second one is just ignored because it asks to do the same as the first one (same mixed configuration).
Expected behavior
Both executions are run without sharing their configuration
Actual behavior
Both executions are run but with same shared and inconsistent configuration
This causing generating not all and falsy classes from xsd
How to Reproduce?
Sample project provided here
highsource/jaxb-tools#362 (comment)
Just run mvn quarkus:dev
Output of uname -a
or ver
Linux Fedora 38
Output of java -version
17
GraalVM version (if different from Java)
No response
Quarkus version or git rev
3.3.1
Build tool (ie. output of mvnw --version
or gradlew --version
)
mvn 3.9
Additional information
Probable fix would be to change this function
private Xpp3Dom getPluginConfig(Plugin plugin, String goal, Map<String, String> params) throws MojoExecutionException {
Xpp3Dom mergedConfig = null;
if (!plugin.getExecutions().isEmpty()) {
for (PluginExecution exec : plugin.getExecutions()) {
if (exec.getConfiguration() != null && exec.getGoals().contains(goal)) {
mergedConfig = mergedConfig == null ? (Xpp3Dom) exec.getConfiguration()
: Xpp3Dom.mergeXpp3Dom(mergedConfig, (Xpp3Dom) exec.getConfiguration(), true);
}
}
}
I would add and extra condition on ids matching (current id is undefined and merge all configurations of undefined executions or id is defined and merge all configuration with undefined executionId or with same id).