Open digulla opened 3 years ago
I was not aware that such stranges are even possible and have semantics in maven. However, this can not be fixed easily: We use maven to read the XML and get Java Beans as model for that. Such processing instructions are not included in that model. PRs are obviously very welcome but this sounds like a rather exotic problem so I have not much time for such fixes. Maybe some others could jump in but do not expect too much...
I was not aware that such stranges are even possible and have semantics in maven.
This m2e feature is actually pretty well hidden: https://www.eclipse.org/m2e/documentation/release-notes-17.html#new-syntax-for-specifying-lifecycle-mapping-metadata
I suppose we could use extra XML reader to read the execution hints and then write them back to the flattened pom.
https://stackoverflow.com/questions/22062587/get-data-within-a-processing-instruction-tag-in-xml/22063351#22063351 has one helpful example on how to read the instructions.
We do somewhat similar hack for the header comment here https://github.com/mojohaus/flatten-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java#L390 and https://github.com/mojohaus/flatten-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java#L465
That feature uses just naive string replace logic which might be buggy if there are comments containing that project tag. We could do similar extra modification of the XML, but preferably with proper XML writer.
https://stackoverflow.com/questions/30668157/how-to-add-a-processing-instruction-jdom2/30668533#30668533 has an example on how to add a processing instruction to XML.
The m2e plugin for Eclipse uses XML processing instructions to mark plugins that are not necessary when building the project in the IDE:
When the POM is processed by the flatten plugin, those markers are lost.
Please copy XML PI to the output unmodified (indentation doesn't matter).