自定义maven插件:节省pom无效pom

时间:2014-11-08 01:45:56

标签: java maven plugins

我编写了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());

1 个答案:

答案 0 :(得分:1)

为什么不使用专为这类任务编写的versions-maven-plugin