Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/updaters/types/maven.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ function pomDocument(contents) {
parseTagValue: false,
// Don't coerce attribute values to numbers/booleans (e.g. keep port="8080" as a string)
parseAttributeValue: false,
// Preserve comments
commentPropName: "#comment",
});
return parser.parse(contents);
}
Expand Down Expand Up @@ -45,6 +47,8 @@ module.exports.writeVersion = function (contents, version) {
// Write fork="true" instead of shorthand fork (which is invalid in XML)
suppressBooleanAttributes: false,
format: true,
// Preserve comments
commentPropName: "#comment",
});
const xml = builder.build(document);

Expand Down
1 change: 1 addition & 0 deletions test/mocks/pom-6.3.1-attrs-lf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<groupId>com.mycompany.app</groupId>
<artifactId>my-module</artifactId>
<version>6.3.1</version>
<!-- preserved-comment -->
<build>
<plugins>
<plugin>
Expand Down
1 change: 1 addition & 0 deletions test/mocks/pom-6.4.0-attrs-lf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<groupId>com.mycompany.app</groupId>
<artifactId>my-module</artifactId>
<version>6.4.0</version>
<!-- preserved-comment -->
<build>
<plugins>
<plugin>
Expand Down