siom79 / japicmp

Comparison of two versions of a jar archive
https://siom79.github.io/japicmp
Apache License 2.0
712 stars 107 forks source link

Configuring multiple site gen reportSets for different version comparisons fails with NPE #232

Closed jeffjensen closed 5 years ago

jeffjensen commented 5 years ago

Hi, I'm trying to configure to run multiple comparisons with the site gen but it is not working yet. I successfully configured it with the cmp goal during the build, but only want it to run with the site gen. Is this possible/supported?

Each of these reportSet sections below works when used by themselves, but when used together it results in NPE:

Caused by: java.lang.NullPointerException                                                                                             
    at japicmp.maven.JApiCmpReport.isPomModuleNeedingSkip (JApiCmpReport.java:142)                                                    
    at japicmp.maven.JApiCmpReport.getDescription (JApiCmpReport.java:131)                                                            
    at org.apache.maven.plugins.site.render.CategorySummaryDocumentRenderer.renderDocument (CategorySummaryDocumentRenderer.java:155)

Before the NPE, it writes a japicmp.html file containing the first reportSet.

<plugin>
  <groupId>com.github.siom79.japicmp</groupId>
  <artifactId>japicmp-maven-plugin</artifactId>
  <version>${japicmpPluginVersion}</version>
  <configuration>
    <parameter>
      <ignoreMissingClasses>true</ignoreMissingClasses>
      <ignoreNonResolvableArtifacts>true</ignoreNonResolvableArtifacts>
      <onlyModified>true</onlyModified>
      <reportOnlyFilename>true</reportOnlyFilename>
    </parameter>
  </configuration>
  <reportSets>
    <reportSet>
      <id>2.6.0-to-current</id>
      <reports>
        <report>cmp-report</report>
      </reports>
      <configuration>
        <oldVersion>
          <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>${project.artifactId}</artifactId>
            <version>2.6.0</version>
            <type>jar</type>
          </dependency>
        </oldVersion>
        <newVersion>
          <file>
            <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
          </file>
        </newVersion>
      </configuration>
    </reportSet>
    <reportSet>
      <id>2.5.4-to-2.6.0</id>
      <reports>
        <report>cmp-report</report>
      </reports>
      <configuration>
        <oldVersion>
          <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>${project.artifactId}</artifactId>
            <version>2.5.4</version>
            <type>jar</type>
          </dependency>
        </oldVersion>
        <newVersion>
          <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>${project.artifactId}</artifactId>
            <version>2.6.0</version>
            <type>jar</type>
          </dependency>
        </newVersion>
      </configuration>
    </reportSet>
  </reportSets>
</plugin>
siom79 commented 5 years ago

Hello @jeffjensen,

having multiple reportSets is supported, but it looks like PR #208 has introduces a regression. I have just fixed it. You can try version 0.11.1, it should be the latest version without PR #208.

jeffjensen commented 5 years ago

Thank you, using v0.11.1 does not NPE. However, japicmp.diff only contains contents for the first . Do I have a config issue, or perhaps there is another problem?

siom79 commented 5 years ago

Yes, you are right. There seems to be an issue with the current implementation of getName() and getDescription(). I will have to do some investigations.

siom79 commented 5 years ago

getName() and getOutputName() now generate different names for different reports.