【发布时间】:2015-03-19 17:12:11
【问题描述】:
我正在使用 org.apache.maven.model.Reporting 类创建一个 maven <reporting> 标签。我正在尝试构建像
预期的输出标签
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
我用来实现相同的代码是,
ReportPlugin reportPlugin = new ReportPlugin();
reportPlugin.setGroupId("org.codehaus.mojo");
reportPlugin.setArtifactId("cobertura-maven-plugin");
Reporting reporting = new Reporting();
reporting.addPlugin(reportPlugin);
但是我得到的输出标签是,
<reporting>
<excludeDefaults>false</excludeDefaults>
<plugins>
<artifactId>cobertura-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
</plugins>
</reporting>
我没有看到像 plugins><plugin>......</plugin></plugins> 这样的plugin 标记,但在上面显示的输出中我只看到了<plugins>......</plugins>。我该如何解决这个问题?
【问题讨论】:
标签: java xml maven xml-parsing pom.xml