From 1e2fd4c5a085ac18ce0cd6fd0556789432d2a399 Mon Sep 17 00:00:00 2001 From: ltheussl Date: Wed, 12 Oct 2005 00:15:09 +0000 Subject: [PATCH] New attempt at pom:validate: Every pom that does not extend another one (a root pom) has to comply with the schema ${plugin.resources}/xsd/pom-strict-3.xsd (this needs review). Running "pom:validate" on a child pom will create another schema ${plugin.resources}/xsd/pom-extend-3.xsd (if this doesn't exist already) via an xslt transformation using the stylesheet ${plugin.resources}/xsl/pom-extend-3.xsl. This just replaces all 'minOccurs="1"' attributes in pom-strict-3.xsd by 'minOccurs="0"'. Namespace is still a problem, I removed it from the xsd (xml:parse seems not to work on documents with namespace declarations?). git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@312982 13f79535-47bb-0310-9956-ffa450edef68 --- pom/plugin.jelly | 47 +- pom/project.xml | 5 + pom/src/plugin-resources/xsd/pom-strict-3.xsd | 1534 +++++++++++++++++ pom/src/plugin-resources/xsd/readme.txt | 17 + pom/src/plugin-resources/xsl/pom-extend-3.xsl | 38 + 5 files changed, 1632 insertions(+), 9 deletions(-) create mode 100644 pom/src/plugin-resources/xsd/pom-strict-3.xsd create mode 100644 pom/src/plugin-resources/xsd/readme.txt create mode 100644 pom/src/plugin-resources/xsl/pom-extend-3.xsl diff --git a/pom/plugin.jelly b/pom/plugin.jelly index f803796d..bfbc5a4b 100644 --- a/pom/plugin.jelly +++ b/pom/plugin.jelly @@ -1,7 +1,7 @@ @@ -59,14 +61,41 @@ name="pom:validate" description="Validate the Maven XML project descriptor"> - - - - + + + + + + - xsd file: ${xsd} + + + + + *** WARNING *** + *** The current pom extends + *** This parent pom has to be validated separately! + + + + + + + + + + + + + + + + + Using xsd file: ${xsd} - ${notice.Level} : ${notice.Section} : ${notice.Message} + ${notice.Level} : ${notice.Section} : ${notice.Message} diff --git a/pom/project.xml b/pom/project.xml index 3b515a86..abf370ff 100644 --- a/pom/project.xml +++ b/pom/project.xml @@ -87,6 +87,11 @@ dom4j 1.4-dev-8 + + commons-jelly + commons-jelly-tags-log + 1.0 + maven maven diff --git a/pom/src/plugin-resources/xsd/pom-strict-3.xsd b/pom/src/plugin-resources/xsd/pom-strict-3.xsd new file mode 100644 index 00000000..56a7254f --- /dev/null +++ b/pom/src/plugin-resources/xsd/pom-strict-3.xsd @@ -0,0 +1,1534 @@ + + + + + + + 3.0.0+ + + The + <code>&lt;project&gt;</code> element specifies + various attributes about a project. This is the root element of the + project descriptor. The following table lists all of the possible child + elements. Child elements with children are then documented further in + subsequent sections. + + + + + + 3.0.0+ + + The + <code>&lt;project&gt;</code> element specifies + various attributes about a project. This is the root element of the + project descriptor. The following table lists all of the possible child + elements. Child elements with children are then documented further in + subsequent sections. + + + + + + 3.0.0 + + The location of the parent + project, if one exists. Values from the parent project will be the + default for this project if they are left unspecified. The path may + be absolute, or relative to the current project.xml file. <div + class="source"><pre>&lt;extend&gt;${basedir}/../project.xml&lt;/extend&gt;</pre></div> + + + + + + 3.0.0 + + The current version of the + Maven project descriptor. This version number enables Maven to + automatically update an out-of-date project descriptor when a new + version is available. This version number should not be changed + after the descriptor has been created. Maven will update it + automatically. + + + + + + + + + + + + + 3.0.0 + + The short name of the + project. This value is used when naming <a + href="/plugins/java/index.html">jars</a> and <a + href="/plugins/dist/index.html">distribution + files</a>. + + + + + + 3.0.0+ + + The short name of the project + group. This value is used to group all jars for a project in one + directory. For more info look at the <a + href="/user-guide.html#Naming%20Conventions">user + guide</a>. + + + + + + 3.0.0+ + + The short name of the + project. This value is used in conjunction with + <code>groupId</code> when naming <a + href="/plugins/java/index.html">jars</a> and <a + href="/plugins/dist/index.html">distribution + files</a>. + + + + + + 3.0.0+ + + The full name of the project. + This value is used when generating <a + href="/plugins/javadoc/index.html">JavaDoc</a> + titles. + + + + + + 3.0.0 + + The current version of the + project. This value is used when naming <a + href="/plugins/java/index.html">jars</a> and <a + href="/plugins/dist/index.html">distribution + files</a>. + + + + + + 3.0.0 + + A short description of the + project. The short description should be limited to a single + line. + + + + + + 3.0.0+ + + Optional. A detailed + description of the project. This description is used as the default + to generate the <a href="/plugins/site/index.html">Mailing + Lists</a> of the project's web site, and is shown when + <code>maven --usage</code> is called on the project. + While this element can be specified as CDATA to enable the use of + HTML tags within the description, you are encouraged to provide an + alternative home page using <code>xdocs/index.xml</code> + if this is required. + + + + + + 3.0.0+ + + The URL to the project's + homepage. + + + + + + 3.0.0 + + The URL to the project's logo + image. This can be an URL relative to the base directory of the + generated web site, (e.g., + <code>/images/project-logo.png</code>) or an absolute + URL (e.g., + <code>http://my.corp/project-logo.png</code>). This is + used when generating the project documentation. + + + + + + 3.0.0 + + Optional. The URL to the + project's issue tracking system. + + + + + + 3.0.0+ + + The year of the project's + inception specified with 4 digits. This value is used when + generating <a + href="/plugins/javadoc/index.html">JavaDoc</a> copyright + notices. + + + + + + 3.0.0 + + Optional. This is the Id of + the Gump repository that this project is part of (assuming it + participates in the Gump integration effort). + + + + + + 3.0.0 + + Optional. The hostname of the + web server that hosts the project's web site. This is used when the + web site is <a + href="/plugins/site/index.html">deployed</a>. + + + + + + 3.0.0 + + Optional. The directory on + the web server where the public web site for this project resides. + This is used when the web site is <a + href="/plugins/site/index.html">deployed</a>. + + + + + + 3.0.0 + + Optional. The server server + where the final distributions will be published. This is used when + the distributions are <a + href="/plugins/dist/index.html">deployed</a>. <p> If + this isn't defined, the central repository is used instead as + determined by <code>maven.repo.central</code> and + <code>maven.repo.central.directory</code> + </p> + + + + + + 3.0.0 + + Optional. The directory on + the web server where the final distributions will be published. This + is used when the distributions are <a + href="/plugins/dist/index.html">deployed</a>. + + + + + + 3.0.0+ + + Contains information about a + project's mailing lists. This is used to generate the <a + href="/plugins/site/index.html">front page</a> of the + site's web site. + + + + + + + + + + + + 3.0.0+ + + Describes the committers to a + project. This is used to generate the <a + href="/plugins/site/index.html">Project Team</a> page of + the project's web site. + + + + + + + + + + + + 3.0.0+ + + Describes the contributors to + a project. This is used to generate the <a + href="/plugins/site/index.html">Project Team</a> page of + the project's web site. + + + + + + + + + + + + 3.0.0+ + + This element describes all of + the licenses for this project. Each license is described by a + <code>license</code> element, which is then described by + additional elements (described below). The auto-generated site + documentation references this information. Projects should only list + the license(s) that applies to the project and not the licenses that + apply to dependencies. + + + + + + + + + + + + 3.0.0 + + Optional. Contains + information on previous versions of the project. This information is + used when invoking the <a + href="/plugins/dist/index.html"><code>maven:dist</code></a> + target. + + + + + + + + + + + + 3.0.0 + + Optional. Contains + information on branches of the project. This information is used + when invoking the <a + href="/plugins/dist/index.html"><code>maven:dist</code></a> + target. + + + + + + + + + + + + 3.0.0 + + Package groups required for + complete javadocs. + + + + + + + + + + + + 3.0.0 + + This element includes the + specification of reports to be included in a Maven-generated site. + These reports will be run when a user executes <code>maven + site</code>. All of the reports will be included in the + navigation bar for browsing in the order they are + specified. + + + + + + + + + + + + 3.0.0 + + Specification for the SCM + used by the project. + + + + + + 3.0.0+ + + This element describes + various attributes of the organization to which the project belongs. + These attributes are utilized when documentation is created (for + copyright notices and links). + + + + + + 3.0.0 + + Project properties that will + be used by various plugins + + + + + + + + + + + + 3.0.0 + + The Java package name of the + project. This value is used when generating <a + href="/plugins/javadoc/index.html">JavaDoc</a>. + + + + + + 3.0.0+ + + Information required to build + the project. + + + + + + 3.0.0+ + + <p> This element + describes all of the dependencies associated with a project. Each + dependency is described by a <code>dependency</code> + element, which is then described by additional elements (described + below). </p> <p> These dependencies are used to + construct a classpath for your project during the build process. + </p> <p> Maven can automatically download these + dependencies from a <a + href="/user-guide.html#Remote%20Repository%20Layout">remote + repository</a>. </p> <p> The filename that Maven + downloads from the repository is + <code>artifactId-version.jar</code> where + <code>artifactId</code> corresponds to the + <code>artifactId</code> element and + <code>version</code> corresponds to the + <code>version</code> element. </p> <p> When + Maven goes looking for a dependency in the remote repository, it + uses the dependency element to construct the URL to download from. + This URL is defined as: </p> <div class="source"> + <pre>${repo}/${groupId}/${type}s/${artifactId}-${version}.${type}</pre> + </div> <p> Where </p> <dl> + <dt>repo</dt> <dd> is the remote repository URL + specified by <code>${maven.repo.remote}</code> + </dd> <dt>groupId</dt> <dd>is taken from the + dependency element</dd> <dt>type</dt> <dd>is + taken from the dependency element</dd> + <dt>artifactId</dt> <dd>is taken from the + dependency element</dd> <dt>version</dt> + <dd>is taken from the dependency element</dd> + </dl> + + + + + + + + + + + + + + 3.0.0+ + + + + + + 3.0.0 + + An address to which + notifications regarding the status of builds for this project can be + sent. This is intended for use by tools which do unattended builds, + for example those providing for continuous integration. Currently + this is used by the <a href="/plugins/gump/">gump + plugin</a> target. + + + + + + 3.0.0+ + + This element specifies a + directory containing the source of the project. The generated build + system will compile the source in this directory when the project is + built. The path given is relative to the project + descriptor. + + + + + + 3.0.0 + + This element specifies a + directory containing the unit test source of the project. The + generated build system will compile these directories when the + project is being tested. The unit tests must use the JUnit test + framework. The path given is relative to the project + descriptor. + + + + + + 3.0.0 + + This element specifies a + directory containing Aspect sources of the project. The generated + build system will compile the Aspects in this directory when the + project is built if Aspects have been enabled (see the <a + href="/plugins/aspectj/goals.html">Aspectj goals</a> + document). The path given is relative to the project + descriptor. + + + + + + 3.0.0 + + This element specifies a + directory containing integration test sources of the + project. + + + + + + 3.0.0 + + This element describes all of + the sourceModifications associated with a project. Each source + modification is described by a + <code>sourceModification</code> element, which is then + described by additional elements (described below). These + modifications are used to exclude or include various source + depending on the environment the build is running + in. + + + + + + + + + + + + 3.0.0 + + This element specifies unit + tests associated with the project. + + + + + + 3.0.0+ + + The default goal (or phase in + Maven 2) to execute when none is specified for the + project. + + + + + + 3.0.0+ + + This element describes all of + the resources associated with a project or unit tests. Each resource + is described by a resource element, which is then described by + additional elements (described <a + href="#resource">below</a>). These resources are used to + complete the jar file or to run unit test. + + + + + + + + + + + + + + 3.0.0 + + + + + + 3.0.0 + + the + description + + + + + + + + + + + + 3.0.0+ + + the + description + + + + + + + + + + + + 3.0.0+ + + the + description + + + + + + + + + + + + + + 3.0.0+ + + This element describes all of the + resources associated with a project or unit tests. Each resource is + described by a resource element, which is then described by additional + elements (described <a href="#resource">below</a>). These + resources are used to complete the jar file or to run unit + test. + + + + + + 3.0.0+ + + Describe the resource target + path. For example, if you want that resource appear into a specific + package (<code>org.apache.maven.messages</code>), you + must specify this element with this value : + <code>org/apache/maven/messages</code> + + + + + + 3.0.0 + + Boolean. Describe if + resources are filtered or not. + + + + + + 3.0.0+ + + Describe the directory where + the resource is stored. The path may be absolute, or relative to the + project.xml file. + + + + + + 3.0.0+ + + the + description + + + + + + + + + + + + 3.0.0+ + + the + description + + + + + + + + + + + + + + 3.0.0 + + This element describes all of the + sourceModifications associated with a project. Each source modification + is described by a <code>sourceModification</code> element, + which is then described by additional elements (described below). These + modifications are used to exclude or include various source depending on + the environment the build is running in. + + + + + + 3.0.0 + + If the class with this name + can <strong>not</strong> be loaded, then the includes + and excludes specified below will be applied to the contents of the + <a + href="#sourceDirectory">sourceDirectory</a> + + + + + + 3.0.0 + + the + description + + + + + + 3.0.0+ + + Describe the directory where + the resource is stored. The path may be absolute, or relative to the + project.xml file. + + + + + + 3.0.0+ + + the + description + + + + + + + + + + + + 3.0.0+ + + the + description + + + + + + + + + + + + + + 3.0.0+ + + Specifies the organization who + produces this project. + + + + + + 3.0.0+ + + The full name of the + organization. + + + + + + 3.0.0+ + + The URL to the organization's + home page. + + + + + + 3.0.0 + + The URL to the organization's + logo image. This can be an URL relative to the base directory of the + generated web site, (e.g., + <code>/images/org-logo.png</code>) or an absolute URL + (e.g., <code>http://my.corp/logo.png</code>). This value + is used when generating the project + documentation. + + + + + + + + 3.0.0+ + + Information about one of the + committers on this project. Derived from + <code>Contributor</code>. + + + + + + 3.0.0+ + + The username of the + developer. + + + + + + 3.0.0+ + + The full name of the + contributor. + + + + + + 3.0.0+ + + The email address of the + contributor. + + + + + + 3.0.0+ + + The URL for the homepage of + the contributor. + + + + + + 3.0.0+ + + The organization to which the + contributor belongs. + + + + + + 3.0.0+ + + The URL of the + organization. + + + + + + 3.0.0+ + + The roles the contributor + plays in the project. Each role is described by a + <code>role</code> element, the body of which is a role + name. + + + + + + + + + + + + 3.0.0+ + + The timezone the contributor + is in. This is a number in the range -11 to 12. + + + + + + 3.0.0+ + + Properties about the + contributor, such as an instant messenger handle. + + + + + + + + + + + + + + 3.0.0+ + + + + + + 3.0.0 + + <p>The name of the + dependency.</p> <p> <strong>Note:</strong> + The use of the id element for a dependency is deprecated. Please use + <code>groupId</code> and + <code>artifactId</code> together instead. + </p> + + + + + + 3.0.0+ + + The project group that + produced the dependency, e.g. + <code>geronimo</code>. + + + + + + 3.0.0+ + + The unique id for an artifact + produced by the project group, e.g. + <code>germonimo-jms</code> + + + + + + 3.0.0+ + + The version of the + dependency, e.g. <code>3.2.1</code> + + + + + + 3.0.0 + + This url will be provided to + the user if the jar file cannot be downloaded from the central + repository. + + + + + + 3.0.0 + + Literal name of the artifact. + Used to override the calculated artifact name. + + + + + + 3.0.0+ + + The type of dependency. This + defaults to <code>jar</code>. Known recognised + dependency types are: <ul> + <li><code>jar</code></li> + <li><code>ejb</code></li> + <li><code>plugin</code></li> + </ul> + + + + + + 3.0.0 + + Properties about the + dependency. Various plugins allow you to + <code>mark</code> dependencies with properties. For + example the <a href="/plugins/war/index.html">war</a> + plugin looks for a <code>war.bundle</code> property, and + if found will include the dependency in + <code>WEB-INF/lib</code>. For example syntax, check the + war plugin docs. + + + + + + + + + + + + + + 3.0.0 + + + + + + 3.0.0 + + <p> Optional. The + source configuration management system URL that describes the + repository and how to connect to the repository. This is used by + Maven when <a href="/plugins/dist/index.html">building + versions</a> from specific ID. </p> <p> The format + of this element is as follows: </p> + <pre>scm:&lt;provider&gt;:&lt;provider-parameters&gt;</pre> + <p>For cvs, the format for pserver repositories should + be:</p> <div class="source"> + <pre>scm:cvs:pserver:user@host:/cvs/root:module-name</pre> + </div> <p> For local networked repositories (eg. pserver + to local machine) </p> <div class="source"> + <pre>scm:cvs:lserver:user@host:/cvs/root:module-name</pre> + </div> <p> For ssh access: </p> <div + class="source"> + <pre>scm:cvs:ext:user@host:/cvs/root:module-name</pre> + </div> Remember that CVS will expect an environment variable + called <code>CVS_RSH</code> to be set, typically to + <code>ssh</code> or your ssh client. <p> Some cvs + clients support other protocols, such as ntserver and extssh. Here's + an example using CVS NT and ntserver: </p> <div + class="source"> + <pre>scm|cvs|ntserver|user@server|e:\cvs|Deployment</pre> + </div> Note the use of the vertical bar as delimiter as the + repository has a colon (<code>:</code>) in it. <p> + For local file system repositories </p> <div + class="source"> + <pre>scm:cvs:local:ignored:/cvs/root:module-name</pre> + </div> <p> For StarTeam access: </p> <div + class="source"> + <pre>scm:starteam:username:password@host:port/project/view/folder</pre> + </div> All of this information can be had from either the + StarTeam Universal Client (Tools-&gt;Server + Administration-&gt;Server Properties) or from the administrator. + <p> The delimiter is determined by the character after "scm". + eg. + <code>scm|cvs|pserver|user@host|/cvs/root|module-name</code> + is equivalent to that listed above. This can be useful for Windows + users who have : in their cvsroot parameter (eg. D:\cvsroot) + </p> <p> Where <code>pserver</code> is the + protocol used to access CVS, <code>user@host</code> is + the user name to log in to the specified cvs + <strong>host</strong>, + <code>/cvs/root</code> is the cvs root directory, and + <code>module-name</code> is the name of the cvs module + to be worked on </p> <p>As an example, the settings for + an Apache project are usually:</p> + <pre>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:module-name</pre> + <p> Currently CVS, Starteam and SubVersion are the only + supported scm's. Others will be added as soon as possible + </p> + + + + + + 3.0.0 + + Just like connection, but for + developers, i.e. this scm connection will not be read + only. + + + + + + 3.0.0 + + The URL to the project's + browsable CVS repository. + + + + + + + + 3.0.0 + + + + + + 3.0.0 + + the + description + + + + + + 3.0.0 + + the + description + + + + + + + + 3.0.0 + + This element describes each of + the previous versions of the project. Each version is described by a + <code>version</code> element + + + + + + 3.0.0 + + The external version number + under which this release was distributed. Examples include: + <code>1.0</code>, <code>1.1-alpha1</code>, + <code>1.2-beta</code>, <code>1.3.2</code> + etc. + + + + + + 3.0.0 + + The name given in the version + control system (e.g. cvs) used by the project for the source code + associated with this version of the project. + + + + + + 3.0.0 + + A unique identifier for a + version. This ID is used to specify the version that <a + href="/plugins/dist/index.html"> + <code>maven:dist</code> </a> + builds. + + + + + + + + 3.0.0+ + + Describes the licenses for this + project. This is used to generate the <a + href="/plugins/site/index.html">License</a> page of the + project's web site. Typically the licenses listed for the project are + that of the project itself, and not of dependencies. + + + + + + 3.0.0+ + + The full legal name of the + license. + + + + + + 3.0.0+ + + The official url for the + license text. + + + + + + 3.0.0+ + + The primary method by which + this project may be distributed. <dl> + <dt>repo</dt> <dd>may be downloaded from the Maven + repository</dd> <dt>manual</dt> <dd>user + must manually download and install the dependency.</dd> + </dl> + + + + + + 3.0.0+ + + Addendum information + pertaining to this license. + + + + + + + + 3.0.0+ + + Description of a person who has + contributed to the project, but who does not have commit privileges. + Usually, these contributions come in the form of patches + submitted. + + + + + + 3.0.0+ + + The full name of the + contributor. + + + + + + 3.0.0+ + + The email address of the + contributor. + + + + + + 3.0.0+ + + The URL for the homepage of + the contributor. + + + + + + 3.0.0+ + + The organization to which the + contributor belongs. + + + + + + 3.0.0+ + + The URL of the + organization. + + + + + + 3.0.0+ + + The roles the contributor + plays in the project. Each role is described by a + <code>role</code> element, the body of which is a role + name. + + + + + + + + + + + + 3.0.0+ + + The timezone the contributor + is in. This is a number in the range -11 to 12. + + + + + + 3.0.0+ + + Properties about the + contributor, such as an instant messenger handle. + + + + + + + + + + + + + + 3.0.0 + + Optional. Contains information on + branches of the project. This information is used when invoking the + <a + href="/plugins/dist/index.html"><code>maven:dist</code></a> + target. + + + + + + 3.0.0 + + The branch tag in the version + control system (e.g. cvs) used by the project for the source code + associated with this branch of the project. + + + + + + + + 3.0.0+ + + This element describes all of the + mailing lists associated with a project. Each mailing list is described + by a <code>mailingList</code> element, which is then + described by additional elements (described below). The auto-generated + site documentation references this information. + + + + + + 3.0.0+ + + The name of the mailing + list. + + + + + + 3.0.0+ + + The email address or link + that can be used to subscribe to the mailing list. If this is an + email address, a <code>mailto:</code> link will + automatically be created when the documentation is + created. + + + + + + 3.0.0+ + + The email address or link + that can be used to unsubscribe to the mailing list. If this is an + email address, a <code>mailto:</code> link will + automatically be created when the documentation is + created. + + + + + + 3.0.0+ + + The email address or link + that can be used to post to the mailing list. If this is an email + address, a <code>mailto:</code> link will automatically + be created when the documentation is created. + + + + + + 3.0.0+ + + The link to a URL where you + can browse the mailing list archive. + + + + + + 3.0.0+ + + The link to other URLs where + you can browse the list archive. + + + + + + + + + + + diff --git a/pom/src/plugin-resources/xsd/readme.txt b/pom/src/plugin-resources/xsd/readme.txt new file mode 100644 index 00000000..8e7fc082 --- /dev/null +++ b/pom/src/plugin-resources/xsd/readme.txt @@ -0,0 +1,17 @@ +Every pom that does not extend another one (a 'root' pom) has to comply +with the schema ${plugin.resources}/xsd/pom-strict-3.xsd. + +Running "pom:validate" on a child pom (a pom that extends another one) +will create another schema ${plugin.resources}/xsd/pom-extend-3.xsd +(if this doesn't exist already) via an xslt transformation using the +stylesheet ${plugin.resources}/xsl/pom-extend-3.xsl. This just replaces +all 'minOccurs="1"' attributes in pom-strict-3.xsd by 'minOccurs="0"'. + + +Note: + +* Every element that is required in a root pom but is not obligatory + in a child pom, needs a 'minOccurs="1"'. + +* Elements that are required in both parent and child poms, must not have + a 'minOccurs' attribute (so they default to 1). diff --git a/pom/src/plugin-resources/xsl/pom-extend-3.xsl b/pom/src/plugin-resources/xsl/pom-extend-3.xsl new file mode 100644 index 00000000..eddf4dc9 --- /dev/null +++ b/pom/src/plugin-resources/xsl/pom-extend-3.xsl @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + 0 + + + + +