1. Maven
  2. MNG-2715

Maven does not comply to XML rules regarding prefixes.


    • Type: Bug Bug
    • Status: Closed 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
    • Complexity:
    • Number of attachments :


      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


          Seva Safris made changes -
          Field Original Value New Value
          Link This issue duplicates MNG-2714 [ MNG-2714 ]
          Nigel Magnay made changes -
          Link This issue is related to MNG-2769 [ MNG-2769 ]
          Jason van Zyl made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Seva Safris made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Carlos Sanchez made changes -
          Link This issue duplicates MNG-2714 [ MNG-2714 ]
          Carlos Sanchez made changes -
          Link This issue is duplicated by MNG-2714 [ MNG-2714 ]
          Carlos Sanchez made changes -
          Link This issue is superceded by MNG-2255 [ MNG-2255 ]
          Jason van Zyl made changes -
          Fix Version/s Reviewed [ 13555 ]
          Brett Porter made changes -
          Component/s POM [ 11339 ]
          Fix Version/s 2.1.x [ 13142 ]
          Fix Version/s Reviewed Pending Version Assignment [ 13555 ]
          Jason van Zyl made changes -
          Fix Version/s 3.0 [ 13142 ]
          Fix Version/s 3.x [ 13145 ]
          Jason van Zyl made changes -
          Fix Version/s 3.x [ 13145 ]
          Status Reopened [ 4 ] Closed [ 6 ]
          Resolution Won't Fix [ 2 ]
          Benjamin Bentmann made changes -
          Link This issue is duplicated by MNG-4708 [ MNG-4708 ]


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


              • Created: