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

<modelVersion> element in pom does not allow whitespace around version string

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.1
    • 3.0-alpha-3
    • POM
    • None

    Description

      I'm using 2.2.x and was surprised to find that, while valid XML, the following are not valid in a pom.xml:

      <modelVersion> 4.0.0 </modelVersion>

      or

      <modelVersion> 4.0.0 </modelVersion>

      I had expected that the maven xml parser would be normalizing the whitespace, but looked in maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java and found this in readModel(), line 1609:

      if ( modelSource.indexOf( "<modelVersion>" + MAVEN_MODEL_VERSION ) < 0 )

      { throw new InvalidProjectModelException( projectId, pomLocation, "Not a v" + MAVEN_MODEL_VERSION + " POM." ); }

      Attachments

        1. pom.xml
          0.4 kB
          jonathan gold
        2. t.txt
          3 kB
          jonathan gold

        Activity

          People

            bentmann Benjamin Bentmann
            jgold.bg jonathan gold
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: