1. Maven
  2. MNG-2715

Maven does not comply to XML rules regarding prefixes.


    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: POM
    • Labels:
    • Environment:
      Ubuntu 6.10
      Maven 2.0.4


      I am new to Maven and have been trying to learn how to create a simple project.
      Let me walk through my scenario of creating a pom.xml file:
      1. I bind the


      namespace (defined at "") to Java classes using an XML Binding solution.
      2. I use the bound classes to create a simple <project/> as one would expect to see in a pom.xml file.
      3. I marshal the bound Java objects into xml and write it into pom.xml. Here is the xml I use:
      <ns1:name>Sample Maven Project</ns1:name>
      <ns1:name>Seva Safris</ns1:name>


      4. I run mvn, and am promptly given a "Not a v4.0.0 POM." exception.

      Tracing through Maven's source, I went to the exact location of the exception in On line 1297 it has:

      if ( modelSource.indexOf( "<modelVersion>4.0.0" ) < 0 )
      throw new InvalidProjectModelException( projectId, pomLocation, "Not a v4.0.0 POM." );

      Since modelSource is checked explicitly for <modelVersion[...], my <project/> xml as shown above will fail this test because it has: <ns1:modelVersion[...].

      This is most definitely a bug in Maven and should be fixed as soon as possible. The workaround is to use a xmlns="" and define all elements without a prefix. However, my use of xmlns:ns1="" should not break Maven as it is not merely legal by xml conventions, but is also a better practice for xml documents.

      I hope you see the importance of getting this bug fixed: My use of a XML Binding solution to bind Maven's xml to Java allows me a strongly-typed level of indirection that will deterministically create proper xml that will validate successfully. If this bug is not fixed, then this level of indirection is not possible (or very very very difficult because the XML Binding solution would have to be hacked to use the xmlns="[...]" convention). I have only found this one instance of where the bug is obvious, but perhaps there are more locations in Maven where the same kind of error can occur.

      Thank you for your time, and I hope you consider this issue as seriously as I do.


      Seva Safris

        Issue Links



            • Assignee:
              Seva Safris
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: