You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jukka Matilainen (Jira)" <ji...@apache.org> on 2022/01/30 12:20:00 UTC

[jira] [Commented] (MPIR-412) Dependency report generates non-well-formed output if the POM of a depdendency cannot be parsed

    [ https://issues.apache.org/jira/browse/MPIR-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17484341#comment-17484341 ] 

Jukka Matilainen commented on MPIR-412:
---------------------------------------

Further information:

When running with the -X command line option, more information is shown:
{code:java}
mvn -X project-info-reports:dependencies {code}
Among the the output:
{noformat}
 [DEBUG] Unable to create Maven project from repository for artifact 'xml-apis:xml-apis-ext:jar:1.3.04'
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] 'distributionManagement.status' must not be specified. @ line 39, column 13    at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:207)
    at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:342)
    at org.apache.maven.report.projectinfo.dependencies.RepositoryUtils.getMavenProjectFromRepository (RepositoryUtils.java:125)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.printDescriptionsAndURLs (DependenciesRenderer.java:898)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.printDependencyListing (DependenciesRenderer.java:855)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.printDependencyListing (DependenciesRenderer.java:875)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderSectionDependencyTree (DependenciesRenderer.java:486)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderSectionProjectDependencyGraph (DependenciesRenderer.java:449)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderBody (DependenciesRenderer.java:222)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.render (AbstractMavenReportRenderer.java:80)
    at org.apache.maven.report.projectinfo.DependenciesReport.executeReport (DependenciesReport.java:163)
    at org.apache.maven.reporting.AbstractMavenReport.generate (AbstractMavenReport.java:251)
    at org.apache.maven.report.projectinfo.AbstractProjectInfoReport.execute (AbstractProjectInfoReport.java:228)
{noformat}
I think that the problem is that if a {{ProjectBuildingException}} is thrown on line [DependenciesRenderer.java:898|https://github.com/apache/maven-project-info-reports-plugin/blob/maven-project-info-reports-plugin-3.1.2/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java#L898] it still the closing tags outside of the try-catch block on lines 1036-1037, even when those tags were not opened in the first place.

> Dependency report generates non-well-formed output if the POM of a depdendency cannot be parsed
> -----------------------------------------------------------------------------------------------
>
>                 Key: MPIR-412
>                 URL: https://issues.apache.org/jira/browse/MPIR-412
>             Project: Maven Project Info Reports Plugin
>          Issue Type: Bug
>          Components: dependencies
>    Affects Versions: 3.1.2
>            Reporter: Jukka Matilainen
>            Priority: Minor
>
> 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.
> h3. How to reproduce
> 1. Use the following POM:
> {code:xml}
> <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>
> {code}
> 2. Run this command:
> {code:bash}
> mvn project-info-reports:dependencies
> {code}
> 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:
> {quote}[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
> {quote}
> h3. 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.
> h3. 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.
> Here is an excerpt from the generated file {{{}target/site/dependencies.html{}}}, with whitespace and indentation manually added to make it more clear:
> {code:xml}
> <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>
> {code}
> There are end tags {{</td></tr></table>}} generated in the output without the corresponding start tags. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)