guru-bharadwaj20 opened a new pull request, #468: URL: https://github.com/apache/maven-help-plugin/pull/468
Fixes #467 The fix for #421 replaces the colon in element names before JDOM parses the effective POM, but the pattern only matched tags without attributes. In the example from the issue, `</ac:if>` was rewritten and `<ac:if xmlns:ac="antlib:net.sf.antcontrib">` was not, so the parse failed with "The element type "ac:if" must be terminated by the matching end-tag". `prettyFormat()` then returned the raw model, which put the header comments before the XML declaration. The pattern now also matches start and empty-element tags that have attributes, so both ends of the element get the same placeholder. Attribute values in single or double quotes are skipped over, so a `>` inside a value doesn't end the match early. The namespace declaration stays on the element and shows up unchanged in the output. Tests: - Added `AbstractEffectiveMojoTest#prettyFormatAcceptsPrefixedElementsWithAttributes`. It fails on master and passes with this change. - Added the `effective-pom-namespaced-element` IT, which uses the POM from the issue with `-Doutput`. It checks that the file starts with the XML declaration, has only one, and keeps `<ac:if xmlns:ac="...">` pretty-printed. It fails on master. - `mvn verify -P run-its` with Maven 3.9.16 and JDK 17 on Windows: 50 unit tests pass and 37 ITs pass (2 skipped), with checkstyle and rat passing. --- - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [ ] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- 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]
