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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 3.0-alpha-3
    • Component/s: POM
    • Labels:
      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. t.txt
          3 kB
          jonathan gold
        2. pom.xml
          0.4 kB
          jonathan gold

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: