[MNG-7805] Make the modelVersion optional when using build pom #1148
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JIRA issue: https://issues.apache.org/jira/browse/MNG-7805
The downside of this PR is that if the build/consumer feature is enabled, all poms will be parsed as events and kept in memory by the
ModelVersionXMLFilter
. The reason is that in theory, themodelVersion
element can be the last element of the rootproject
element. Given the way the build/consumer POM feature is implemented, the same mechanism is used to read the POM (i.e. xml to object model) and rewrite it (when installing/deploying), so that the transformed XML has to be clean wrt formatting, etc...A possible performance improvement would be to have filters operate in two modes, the first one during the first phase (I.e. xml element ordering, formatting is irrelevant, and this phase could even be done on the object model) and a second one to rewrite the POM.
But I think the performance loss is quite negligible as the number of POMs parsed with the build/consumer feature filter enabled is the number of projects in the reactor, so it should be usually an order of magnitude lower than the total number of POMs parsed for plugins / dependencies.