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

Maven XML parser does not accept '>' in XML processing instructions

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.6.1
    • Fix Version/s: 3.6.2
    • Component/s: None
    • Labels:
      None

      Description

      Maven 3.6 does not accept the char '>' in XML processing instructions (PI), but '>' is a valid char in PIs. Previous versions of Maven (tested with 3.5) are not affected.

      Example:

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>org.apache.test</groupId>
        <artifactId>xmlbugtest</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
        <?foo bar > bar ?>
      </project>
      

      Maven 3.6 fails to parse the given POM:

      [INFO] Error stacktraces are turned on.
      [INFO] Scanning for projects...
      [ERROR] [ERROR] Some problems were encountered while processing the POMs:
      [FATAL] Non-parseable POM /home/rroesch/tests/mavenxmlbug/pom.xml: processing instruction started on line 7 and column 5 was not closed (position: END_TAG seen ...</packaging>\n  <?foo bar >... @7:14)  @ line 7, column 14
       @ 
      [ERROR] The build could not read 1 project -> [Help 1]
      org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
      [FATAL] Non-parseable POM /home/rroesch/tests/mavenxmlbug/pom.xml: processing instruction started on line 7 and column 5 was not closed (position: END_TAG seen ...</packaging>\n  <?foo bar >... @7:14)  @ line 7, column 14
      
          at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:395)
          at org.apache.maven.graph.DefaultGraphBuilder.collectProjects (DefaultGraphBuilder.java:414)
          at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor (DefaultGraphBuilder.java:405)
          at org.apache.maven.graph.DefaultGraphBuilder.build (DefaultGraphBuilder.java:82)
          at org.apache.maven.DefaultMaven.buildGraph (DefaultMaven.java:507)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:219)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
          at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:498)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
      [ERROR]   
      [ERROR]   The project  (/home/rroesch/tests/mavenxmlbug/pom.xml) has 1 error
      [ERROR]     Non-parseable POM /home/rroesch/tests/mavenxmlbug/pom.xml: processing instruction started on line 7 and column 5 was not closed (position: END_TAG seen ...</packaging>\n  <?foo bar >... @7:14)  @ line 7, column 14 -> [Help 2]
      org.apache.maven.model.io.ModelParseException: processing instruction started on line 7 and column 5 was not closed (position: END_TAG seen ...</packaging>\n  <?foo bar >... @7:14) 
          at org.apache.maven.model.io.DefaultModelReader.read (DefaultModelReader.java:114)
          at org.apache.maven.model.io.DefaultModelReader.read (DefaultModelReader.java:82)
          at org.apache.maven.model.building.DefaultModelProcessor.read (DefaultModelProcessor.java:84)
          at org.apache.maven.model.building.DefaultModelBuilder.readModel (DefaultModelBuilder.java:544)
          at org.apache.maven.model.building.DefaultModelBuilder.build (DefaultModelBuilder.java:276)
          at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:446)
          at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:412)
          at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:375)
          at org.apache.maven.graph.DefaultGraphBuilder.collectProjects (DefaultGraphBuilder.java:414)
          at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor (DefaultGraphBuilder.java:405)
          at org.apache.maven.graph.DefaultGraphBuilder.build (DefaultGraphBuilder.java:82)
          at org.apache.maven.DefaultMaven.buildGraph (DefaultMaven.java:507)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:219)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
          at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:498)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
      Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: processing instruction started on line 7 and column 5 was not closed (position: END_TAG seen ...</packaging>\n  <?foo bar >... @7:14) 
          at org.codehaus.plexus.util.xml.pull.MXParser.parsePI (MXParser.java:3057)
          at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl (MXParser.java:1500)
          at org.codehaus.plexus.util.xml.pull.MXParser.next (MXParser.java:1319)
          at org.codehaus.plexus.util.xml.pull.MXParser.nextTag (MXParser.java:1302)
          at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.parseModel (MavenXpp3ReaderEx.java:2319)
          at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.read (MavenXpp3ReaderEx.java:4425)
          at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.read (MavenXpp3ReaderEx.java:598)
          at org.apache.maven.model.io.DefaultModelReader.read (DefaultModelReader.java:105)
          at org.apache.maven.model.io.DefaultModelReader.read (DefaultModelReader.java:82)
          at org.apache.maven.model.building.DefaultModelProcessor.read (DefaultModelProcessor.java:84)
          at org.apache.maven.model.building.DefaultModelBuilder.readModel (DefaultModelBuilder.java:544)
          at org.apache.maven.model.building.DefaultModelBuilder.build (DefaultModelBuilder.java:276)
          at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:446)
          at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:412)
          at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:375)
          at org.apache.maven.graph.DefaultGraphBuilder.collectProjects (DefaultGraphBuilder.java:414)
          at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor (DefaultGraphBuilder.java:405)
          at org.apache.maven.graph.DefaultGraphBuilder.build (DefaultGraphBuilder.java:82)
          at org.apache.maven.DefaultMaven.buildGraph (DefaultMaven.java:507)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:219)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
          at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:498)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
      [ERROR] 
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
      [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException
      

       

      Even if PIs are not evaluated by Maven, they can be used as alternative to XML comments. Example: parquet-1.9.0-cdh6.2.0.pom line 286 is not parsable by Maven 3.6.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                olamy Olivier Lamy
                Reporter:
                rroesch Raphael Rösch
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: