我正在尝试在 maven
构建周期中验证我的 XML 资源。是否有用于此目的的任何插件,或者我应该手动使用 ant
+ xmllint
?
最佳答案
如果您只需要验证 XML 文件,那么您可以使用 Maven XML Plugin .
The following example would check all files in the directory "xml" for well formedness. Additionally, it would validate all files in the directory "xsd" against the schema "xmlschema.xml".
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
<configuration>
<validationSets>
<validationSet>
<dir>xml</dir>
</validationSet>
<validationSet>
<dir>xsd</dir>
<systemId>xmlschema.xml</systemId>
</validationSet>
</validationSets>
</configuration>
</plugin>
关于java - 是否有任何 XML lint maven 插件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3931901/