Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-2769

Use of POM namespace is confused and confusing in both the code and the documentation

    XMLWordPrintableJSON

Details

    Description

      Looking at the (very good) documentation on the POM at http://maven.apache.org/pom.html, the very first link is to the POM XSD, the schema definition for the XML. This XSD explicitly places POMs into the namespace targetNamespace="http://maven.apache.org/POM/4.0.0".

      However, the immediately following examples of POMs do not place their examples inside this namespace (there should be an xmlns="http://maven.apache.org/POM/4.0.0" at the root element).

      Taking a look through my local repository, it's all a bit hit-and-miss as to whether the defined POM is in the correct namespace or not.

      This is really annoying, because any tools I write that wish to use standard XML parsers to consume the POM need, in effect, to pass a namespace manager around, because if I wish to XPath to 'dependencies', I have to say 'is this //pom:dependencies, or is it a "defective" POM, where it's just //dependencies. This is bad if I'm using XSLT too (as one might to display a 'prettyprinted' POM).

      • The documentation should use the namespace
      • Maven should probably warn when it meets a POM that it's compiling from contains information in an invalid namespace.
      • Maven should re-namespace POMs to be in the 'right' namespace when copying to repositories (or perhaps modify any POM.xml that it sees which is incorrect automatically).

      Attachments

        Issue Links

          Activity

            People

              siveton Siveton Vincent
              magnayn nigel magnay
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: