How can I validate XML documents during a Maven build against a DTD or a XSD Schema?
The validate goal of the xml-maven-plugin will check for well-formedness and optionally validate against a schema. The build will fail if the validation fails.
The plugin does not produce any report, what would you want in a report out of interest? information about the invalid files?
Here is an example usage:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
<configuration>
<validationSets>
<validationSet>
<dir>src/main/xml</dir>
<systemId>src/main/xmlschema.xsd</systemId>
</validationSet>
</validationSets>
</configuration>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With