Skip to content

NPE during report aggregation when multiple modules are specified using -pl arg #103

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

Closed
sumeetgajjar opened this issue Feb 3, 2022 · 1 comment · Fixed by #104
Closed

Comments

@sumeetgajjar
Copy link
Contributor

Hi,

Consider the following multi-module maven project.

  • Parent
    • child1
    • child2
      • GrandChild1
      • GrandChild2
    • child3

On running mvn -pl child1,child2/GrandChild1 clean scoverage:report -e, the command fails with the following null pointer exception:

[INFO] Reactor Summary:
[INFO]
[INFO] child1 1.0-SNAPSHOT ................................ SUCCESS [  7.912 s]
[INFO] child3 1.0-SNAPSHOT ................................ FAILURE [  5.126 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.185 s
[INFO] Finished at: 2022-02-02T21:57:03-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.scoverage:scoverage-maven-plugin:1.4.11:report (default-cli) on project child3: An error has occurred in SCoverage report generation: Report generation exception: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.scoverage:scoverage-maven-plugin:1.4.11:report (default-cli) on project child3: An error has occurred in SCoverage report generation: Report generation exception
.
.
.
Caused by: java.lang.NullPointerException
    at org.scoverage.plugin.SCoverageReportMojo.rebase (SCoverageReportMojo.java:560)
    at org.scoverage.plugin.SCoverageReportMojo.generateAggregatedReports (SCoverageReportMojo.java:506)
    at org.scoverage.plugin.SCoverageReportMojo.generate (SCoverageReportMojo.java:230)
    at org.scoverage.plugin.SCoverageReportMojo.execute (SCoverageReportMojo.java:385)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)

This is because neither child1 nor child3 returns true for module.isExecutionRoot() and thus topLevelModule is always null.

MavenProject topLevelModule = null;
for ( MavenProject module : reactorProjects )
{
if ( module.isExecutionRoot() )
{
topLevelModule = module;
}

@jozic
Copy link
Collaborator

jozic commented Dec 27, 2023

seems related to #93

jozic added a commit to sumeetgajjar/scoverage-maven-plugin that referenced this issue Dec 28, 2023
jozic added a commit to sumeetgajjar/scoverage-maven-plugin that referenced this issue Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants