The pom:validate
goal performs a validation of your
project descriptor (project.xml
, pom) against an xsd
schema. The general form of a project descriptor can be found
on the main Maven
site.
WARNING: for the pom:validate
goal
to work, your project descriptor (project.xml
) has
to be at least parsable and well-formed in the first place
(chicken or egg?). If your pom is not well-formed, Maven
will fail with a (hopefully useful) error message before any
plugin starts to work. If you are having problems getting Maven
to run, you should try to validate your pom with an independent
xml validation tool first.
In order to be valid, your project.xml
file needs
to include a namespace declaration in the project root element:
<project xmlns="http://maven.apache.org/POM/3.0.0">
or
<project xmlns="http://maven.apache.org/POM/3.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/3.0.0 http://maven.apache.org/maven-v3_0_0.xsd">
The validation routine works differently for stand-alone
poms and poms that extend other ones (child poms).
The following table shows which
top-level elements (i.e., elements just below the
<project>
root) are required in each case.
Element name | Required in stand-alone pom? | Required in child pom? | Remarks |
---|---|---|---|
<extend/> |
N/A | Yes | |
<pomVersion/> |
Yes | No | |
<id/> |
No | No | Deprecated, use <groupId/> and <artifactId/> instead. |
<groupId/> |
Yes | No | |
<artifactId/> |
Yes | No | |
<name/> |
Yes | No | |
<currentVersion/> |
Yes | No | |
<description/> |
No | No | |
<shortDescription/> |
No | No | |
<url/> |
No | No | |
<logo/> |
No | No | |
<issueTrackingUrl/> |
No | No | |
<inceptionYear/> |
Yes | No | |
<gumpRepositoryId/> |
No | No | |
<siteAddress/> |
No | No | |
<siteDirectory/> |
No | No | |
<distributionSite/> |
No | No | |
<distributionDirectory/> |
No | No | |
<mailingLists> |
No | No | |
<developers> |
No | No | |
<contributors> |
No | No | |
<licenses> |
No | No | |
<versions> |
No | No | |
<branches> |
No | No | |
<packageGroups> |
No | No | |
<reports> |
No | No | |
<repository> |
No | No | |
<organization> |
No | No | |
<properties> |
No | No | |
<package/> |
No | No | |
<build> |
No | No | |
<dependencies> |
No | No |