|
23 | 23 | import java.io.ByteArrayOutputStream; |
24 | 24 | import java.io.File; |
25 | 25 | import java.io.IOException; |
| 26 | +import java.io.OutputStreamWriter; |
| 27 | +import java.io.Writer; |
| 28 | +import java.nio.charset.StandardCharsets; |
26 | 29 | import java.nio.file.DirectoryStream; |
27 | 30 | import java.nio.file.FileVisitResult; |
28 | 31 | import java.nio.file.Files; |
|
80 | 83 | import org.apache.maven.model.Plugin; |
81 | 84 | import org.apache.maven.model.PluginExecution; |
82 | 85 | import org.apache.maven.model.Resource; |
83 | | -import org.apache.maven.model.io.DefaultModelWriter; |
| 86 | +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; |
84 | 87 | import org.apache.maven.project.MavenProject; |
85 | 88 | import org.eclipse.aether.RepositorySystem; |
86 | 89 | import org.eclipse.aether.artifact.DefaultArtifactType; |
@@ -213,6 +216,8 @@ public ProjectsInputInfo calculateChecksum() throws IOException { |
213 | 216 | projectVersion.setIsText("yes"); |
214 | 217 | projectVersion.setValue(project.getVersion()); |
215 | 218 | items.add(projectVersion); |
| 219 | + |
| 220 | + checksum.update(project.getVersion().getBytes(StandardCharsets.UTF_8)); |
216 | 221 | } |
217 | 222 |
|
218 | 223 | DigestItem effectivePomChecksum = DigestUtils.pom(checksum, effectivePom); |
@@ -336,13 +341,14 @@ private boolean checkItemMatchesBaseline(ProjectsInputInfo baselineBuild, Digest |
336 | 341 | */ |
337 | 342 | private String getEffectivePom(Model prototype) throws IOException { |
338 | 343 | ByteArrayOutputStream output = new ByteArrayOutputStream(); |
339 | | - new DefaultModelWriter().write(output, Collections.emptyMap(), prototype); |
| 344 | + try (Writer writer = new OutputStreamWriter(output, StandardCharsets.UTF_8)) { |
| 345 | + new MavenXpp3Writer().write(output, prototype); |
| 346 | + } |
340 | 347 |
|
341 | 348 | // normalize env specifics |
342 | 349 | final String[] searchList = {baseDirPath.toString(), "\\", "windows", "linux"}; |
343 | 350 | final String[] replacementList = {"", "/", "os.classifier", "os.classifier"}; |
344 | 351 |
|
345 | | - //Normalize output to ensure consistent encoding, line ending, and whitespace |
346 | 352 | String result = output.toString(java.nio.charset.StandardCharsets.UTF_8.name()); |
347 | 353 | result = result.replace("\r\n", "\n"); |
348 | 354 | result = result.trim(); |
|
0 commit comments