Uploaded image for project: 'Maven Ant Tasks (RETIRED)'
  1. Maven Ant Tasks (RETIRED)
  2. MANTTASKS-126

Exception "parser must be on START_TAG or TEXT to read text" in MavenXpp3Reader for model-3.0.0 POMs.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0-alpha-3
    • None
    • dependencies task
    • None
    • Not of importance.

    Description

      I have an ANT script using maven antlib (alpha-3) as follows:

      ...

      <target name="getdeps">
      <artifact:remoteRepository
      id="remote.repository" url="http://172.16.40.249/ourrepo" layout="legacy"/>

      <artifact:dependencies verbose="true">
      <remoteRepository refid="remote.repository"/>
      <dependency groupId="sis2" artifactId="sis2-common" version="0.1"/>
      </artifact:dependencies>
      </target>

      ...

      I already posted a problem http://jira.codehaus.org/browse/MNG-666 when model-3.0.0 POMs are validated. This was temporarily solved by adding an element <modelVersion> in the POM. However an additional problem is that the POM contains several dependencies with a <properties> subelement, e.g.:

      <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>2.0</version>
      <properties>
      <jar.manifest.classpath>true</jar.manifest.classpath>
      </properties>
      </dependency>

      The fact that subelements are present in <properties> causes the following exception:

      — Nested Exception —
      org.apache.maven.artifact.resolver.TransitiveArtifactResolutionException: Unable to read the metadata file
      sis2:sis2-common:0.1:jar

      from the specified remote repositories:
      http://172.16.40.249/ourrepo
      Path to dependency:
      1) unspecified:unspecified:jar:0.0

      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:164)
      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.collect(DefaultArtifactCollector.java:66)
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:173)
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:199)
      at org.apache.maven.artifact.ant.DependenciesTask.execute(DependenciesTask.java:115)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      at org.apache.tools.ant.Task.perform(Task.java:364)
      at org.apache.tools.ant.Target.execute(Target.java:341)
      at org.apache.tools.ant.Target.performTasks(Target.java:369)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
      at org.apache.tools.ant.Main.runBuild(Main.java:668)
      at org.apache.tools.ant.Main.startAnt(Main.java:187)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
      Caused by: org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException: Unable to read the metadata file
      at org.apache.maven.project.artifact.MavenMetadataSource.retrieve(MavenMetadataSource.java:88)
      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:151)
      ... 16 more
      Caused by: org.apache.maven.project.ProjectBuildingException: Failed to parse model from file 'C:\Documents and Settings\dto\.m2\repository\sis2\sis2-common\0.1\sis2-common-0.1.pom'.
      Error: 'TEXT must be immediately followed by END_TAG and not START_TAG (position: START_TAG seen ...<properties>\n <jar.manifest.classpath>... @31:33) '
      at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:525)
      at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:244)
      at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:218)
      at org.apache.maven.project.artifact.MavenMetadataSource.retrieve(MavenMetadataSource.java:81)
      ... 17 more
      Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: TEXT must be immediately followed by END_TAG and not START_TAG (position: START_TAG seen ...<properties>\n <jar.manifest.clas
      spath>... @31:33)
      at org.codehaus.plexus.util.xml.pull.MXParser.nextText(MXParser.java:1059)
      at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseDependency(MavenXpp3Reader.java:695)
      at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Reader.java:1317)
      at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:2604)
      at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:510)
      ... 20 more
      The central repository contains only artifacts with model-3.0.0 POMs (generated by Maven 1.1).

      The problem is that the method MavenXpp3Reader.parseDependency doesn't correctly parse the element <properties>.

      Regards,
      Davy Toch

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dtoch Davy Toch
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: