Uploaded image for project: 'Maven Project Info Reports Plugin'
  1. Maven Project Info Reports Plugin
  2. MPIR-412

Dependency report generates non-well-formed output if the POM of a depdendency cannot be parsed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.1.2
    • 3.2.1
    • dependencies
    • None

    Description

      If there is dependency whose POM cannot be parsed, the output from the dependency report is not well-formed, with start and end tags not matching each other.

      This causes problems when using maven-pdf-plugin, which skips the depedency report entirely if it is not well-formed.

      How to reproduce

      1. Use the following POM:

      <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>fi.iki.jkmatila</groupId>
        <artifactId>repro-dependency-report-bug</artifactId>
        <version>1.0-SNAPSHOT</version>
        <dependencies>
          <!-- an example of a dependency which will trigger this problem: --> 
          <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis-ext</artifactId>
            <version>1.3.04</version>
          </dependency>
        </dependencies>
        <build>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
              <version>3.1.2</version>
            </plugin>
          </plugins>
        </build>
      </project>
      

      2. Run this command:

      mvn project-info-reports:dependencies
      

      Note that since there is a problem with the POM of xml-apis:xml-apis-ext:jar:1.3.04 (the distributionManagement tag contains a status tag inside), there is a message displayed about that:

      [INFO] Unable to create Maven project from repository for artifact 'xml-apis:xml-apis-ext:jar:1.3.04', for more information run with -X

      Expected results

      Even if there is a dependency with problems in its POM, I would expect the generated dependency report to be well-formed (even if the details for that dependency are missing), so that maven-pdf-plugin can process that dependency report.

      Observed results

      The generated Dependency Tree secion in the dependency report is not well-formed, with start tags and end tags not matching each other. This causes problems with maven-pdf-plugin.

      $ xmllint --noout target/site/dependencies.html
      target/site/dependencies.html:94: parser error : Opening and ending tag mismatch: div line 94 and td
      ; vertical-align: text-bottom;"></img><div id="_dep2" style="display:none"></td> 
      [...]

      Here is an excerpt from the generated file target/site/dependencies.html, with whitespace and indentation manually added to make it more clear:

      <section>
        <h3><a name="Dependency_Tree"></a>Dependency Tree</h3>
        <ul>
          <li>
            fi.iki.jkmatila:repro-dependency-report-bug:jar:1.0-SNAPSHOT
            <img id="_img1" src="./images/icon_info_sml.gif" alt="[Information]" onclick="toggleDependencyDetails( '_dep0', '_img1' );" style="cursor: pointer; vertical-align: text-bottom;"></img>
            <div id="_dep0" style="display:none">
              <table border="0" class="bodyTable">
                <tr class="a">
                  <th>repro-dependency-report-bug</th>
                </tr>
                <tr class="b">
                  <td>
                    <p><b>Description: </b>There is currently no description associated with this project.</p>
                    <p><b>Project Licenses: </b>No licenses are defined for this project.</p>
                  </td>
                </tr>
              </table>
            </div>
            <ul>
              <li>
                xml-apis:xml-apis-ext:jar:1.3.04 (compile)
                <img id="_img3" src="./images/icon_info_sml.gif" alt="[Information]" onclick="toggleDependencyDetails( '_dep2', '_img3' );" style="cursor: pointer; vertical-align: text-bottom;"></img>
                <div id="_dep2" style="display:none">
      
                      </td>
                    </tr>
                  </table>
                </div>
              </li>
            </ul>
          </li>
        </ul>
      </section>
      

      There are end tags </td></tr></table> generated in the output without the corresponding start tags. 

      Attachments

        Issue Links

          Activity

            People

              michael-o Michael Osipov
              jkmatila Jukka Matilainen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: