Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE on site generation #358

Closed
hohwille opened this issue Nov 26, 2019 · 7 comments · Fixed by #373
Closed

NPE on site generation #358

hohwille opened this issue Nov 26, 2019 · 7 comments · Fixed by #373
Labels

Comments

@hohwille
Copy link
Member

In my project site-generation fails if license-maven-plugin:2.0.0 is configured.

...
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>third-party-report</report>
              <report>aggregate-third-party-report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
     </plugins>
  </reporting>

Stacktrace:

Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-site of goal org.apache.maven.plugins:maven-site-plugin:3.7.1:site failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    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 jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    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: java.lang.NullPointerException
    at java.util.HashSet.<init> (HashSet.java:119)
    at org.codehaus.mojo.license.api.ResolvedProjectDependencies.<init> (ResolvedProjectDependencies.java:50)
    at org.codehaus.mojo.license.AbstractThirdPartyReportMojo.createThirdPartyDetails (AbstractThirdPartyReportMojo.java:559)
    at org.codehaus.mojo.license.AggregatorThirdPartyReportMojo.createThirdPartyDetails (AggregatorThirdPartyReportMojo.java:127)
    at org.codehaus.mojo.license.AbstractThirdPartyReportMojo.executeReport (AbstractThirdPartyReportMojo.java:420)
    at org.apache.maven.reporting.AbstractMavenReport.generate (AbstractMavenReport.java:251)
    at org.apache.maven.plugins.site.render.ReportDocumentRenderer.renderDocument (ReportDocumentRenderer.java:230)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:349)
    at org.apache.maven.plugins.site.render.SiteMojo.renderLocale (SiteMojo.java:198)
    at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:147)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    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 jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    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)
@hohwille
Copy link
Member Author

hohwille commented Nov 26, 2019

NPE happens here:

this.directDependencies = Collections.unmodifiableSet( new HashSet<>( directDependencies ) );

So the provided Set (directDependencies) to make immutable is already null.

@hohwille
Copy link
Member Author

hohwille commented Nov 26, 2019

at org.codehaus.mojo.license.AbstractThirdPartyReportMojo.createThirdPartyDetails (AbstractThirdPartyReportMojo.java:559)

According to your tag license-maven-plugin-2.0.0 this is here:

https://github.com/mojohaus/license-maven-plugin/blob/license-maven-plugin-2.0.0/src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReportMojo.java#L559

@hohwille
Copy link
Member Author

So project.getDependencyArtifacts() was null in my case? Strange...

@hohwille
Copy link
Member Author

Breaking the entire site build with an exception is always bad. However, just tested to downgrade to version 1.20 and the problem is gone. So maybe easy to fix and ship a 2.x.y version.

@planetf1
Copy link

I was just about to raise the same issue! Getting exactly the same when trying to build the third party aggregate report - NPE.

@planetf1
Copy link

can confirm 1.20 does not exhibit this problem

@Tibor17
Copy link
Contributor

Tibor17 commented Mar 27, 2020

@ppalaga
This trivial NPE should be fixed asap. It is very annoying to see a broken build because of NPE!

tomred-net pushed a commit to tomred-net/license-maven-plugin that referenced this issue Apr 12, 2020
…precated MavenProject.getDependencyArtifacts()
tomred-net pushed a commit to tomred-net/license-maven-plugin that referenced this issue Apr 12, 2020
…precated MavenProject.getDependencyArtifacts()
tomred-net pushed a commit to tomred-net/license-maven-plugin that referenced this issue Apr 12, 2020
…precated MavenProject.getDependencyArtifacts()
tomred-net pushed a commit to tomred-net/license-maven-plugin that referenced this issue Apr 12, 2020
…precated MavenProject.getDependencyArtifacts()
tomred-net pushed a commit to tomred-net/license-maven-plugin that referenced this issue Apr 12, 2020
…precated MavenProject.getDependencyArtifacts()
tomred-net pushed a commit to tomred-net/license-maven-plugin that referenced this issue Apr 12, 2020
…precated MavenProject.getDependencyArtifacts()
tomred-net pushed a commit to tomred-net/license-maven-plugin that referenced this issue Apr 12, 2020
…precated MavenProject.getDependencyArtifacts()
slawekjaranowski added a commit that referenced this issue Jul 3, 2023
…ecated MavenProject.getDependencyArtifacts() (#373)


Co-authored-by: Dermot Butterfield <[email protected]>
Co-authored-by: Slawomir Jaranowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants