Skip to content

Maven related cheatsheet

modem_down edited this page Jun 6, 2017 · 1 revision

POM validation

To validate a POM against its schema, we can use a one-liner combination of:

  • xmllint (which identifies which element, if any, is invalid);
  • xmlstarlet (which allows us to extract the schema attribute);
  • GNU grep (which allows us to extract the XSD's URL from the schema attribute):
xmllint --noout --schema $(xmlstarlet sel -t -v "/_:project/@xsi:schemaLocation" -n pom.xml | grep -o 'http[^ ]*.xsd') pom.xml
Clone this wiki locally