maven-plugins/pom/xdocs/validation.xml
2005-12-07 00:19:31 +00:00

204 lines
6.3 KiB
XML

<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Validation</title>
</properties>
<body>
<section name="Validating your POM">
<p>
The <code>pom:validate</code> goal performs a validation of your
project descriptor (<code>project.xml</code>, pom) against an xsd
schema. The general form of a project descriptor can be found
on the main Maven
<a href="http://maven.apache.org/maven-1.x/reference/project-descriptor.html">site</a>.
</p>
<p>
<strong>WARNING</strong>: for the <code>pom:validate</code> goal
to work, your project descriptor (<code>project.xml</code>) 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.
</p>
<subsection name="Namespace">
<p>
In order to be valid, your <code>project.xml</code> file needs
to include a namespace declaration in the project root element:
</p>
<source><![CDATA[<project xmlns="http://maven.apache.org/POM/3.0.0">]]></source>
<p>
or
</p>
<source><![CDATA[<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">]]></source>
</subsection>
<subsection name="Required elements">
<p>
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 (<em>i.e.</em>, elements just below the
<code>&lt;project&gt;</code> root) are required in each case.
</p>
<table>
<tr>
<th>Element name</th>
<th>Required in stand-alone pom?</th>
<th>Required in child pom?</th>
</tr>
<tr>
<td><code>&lt;extend/&gt;</code></td>
<td>N/A</td><td>Yes</td>
</tr>
<tr>
<td><code>&lt;pomVersion/&gt;</code></td>
<td>Yes</td><td>Yes</td>
</tr>
<tr>
<td><code>&lt;id/&gt;</code></td>
<td>Yes</td><td>Yes</td>
</tr>
<tr>
<td><code>&lt;groupId/&gt;</code></td>
<td>Yes</td><td>No</td>
</tr>
<tr>
<td><code>&lt;artifactId/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;name/&gt;</code></td>
<td>Yes</td><td>Yes</td>
</tr>
<tr>
<td><code>&lt;currentVersion/&gt;</code></td>
<td>Yes</td><td>Yes</td>
</tr>
<tr>
<td><code>&lt;description/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;shortDescription/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;url/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;logo/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;issueTrackingUrl/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;inceptionYear/&gt;</code></td>
<td>Yes</td><td>No</td>
</tr>
<tr>
<td><code>&lt;gumpRepositoryId/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;siteAddress/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;siteDirectory/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;distributionSite/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;distributionDirectory/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;mailingLists&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;developers&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;contributors&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;licenses&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;versions&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;branches&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;packageGroups&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;reports&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;repository&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;organization&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;properties&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;package/&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;build&gt;</code></td>
<td>No</td><td>No</td>
</tr>
<tr>
<td><code>&lt;dependencies&gt;</code></td>
<td>No</td><td>No</td>
</tr>
</table>
</subsection>
</section>
</body>
</document>