我编写了maven插件的代码,用于更新pom文件中的版本号。然而,当我尝试保存新的pom时,它被保存为有效的pom。有没有办法在解析之前保存它? 谢谢!
private MavenProject project;
String newVersion = updateProjectVersion(project);
project.setVersion(newVersion);
// write project object into pom file
MavenXpp3Writer pomWriter = new MavenXpp3Writer();
releasePomFile = ReleaseUtil.getStandardPom(project);
Writer fileWriter = null;
String scmUrl = project.getScm().getConnection();
fileWriter = WriterFactory.newXmlWriter(releasePomFile);
pomWriter.write(fileWriter, project.getModel());