You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just checked the above test case with version 1.1.0 of the tidy-maven-plugin: tidy:check no longer complains about the pom.xm and tidy:check leaves it alone.
While this is nice, I wouldn’t close this issue yet; the effect of the bug is so strange (the pom.xml being concatenated with its tidied form) that it is probably worth debugging version 1.0.0 just to figure out how on earth this could happen at all – and whether it still can happen with other inputs.
This was an issue with plugins that uses configuration elements with the same name as the pom. See #8 and #14.
As to why the pom is concatenated, it's a couple of things that seems to cause it. The first of which is that the formatter finds the element (#14) and tries to format the 3 expected nodes (groupId, artifactId, version) inside. Nothing has been formatted at this point if my understanding is correct but the formatter continues (the "wrong" nodes are appended in the result - unchanged).
Next, the formatter should concatenate the rest of the pom after the last node inside . It does so by calculating the start/end positions of the 3 nodes (see calculateStartsAndEnds) to find the very last position.
These nodes are never found, thus start/end are left with their initialized values; Integer.MAX and -1 respectively. Apparently all the nodes inside ends at position -1, which the formatter defaults to 0. Instead of concatenating from the last node, the formatter concatenates from 0.
The following self-contained
pom.xml
is completely broken bytidy:pom
(version 1.0.0):The resulting POM consists of two POMs concatenated together:
Also, the resulting POM contains this sequence of broken formatting:
The text was updated successfully, but these errors were encountered: