Skip to content

Commit

Permalink
Report mojo: find a top level module for "mvn -pl"
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Meltzer authored and kitbellew committed Dec 26, 2023
1 parent e55882c commit 73e91d1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/main/java/org/scoverage/plugin/SCoverageReportMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,36 @@ else if ( !module.getPackaging().equals( "pom" ) )
}
}

if (null == topLevelModule)
{
for ( MavenProject module : reactorProjects )
{
if ( !module.hasParent() )
{
continue;
}

MavenProject parent = module.getParent();
while ( parent.hasParent() )
{
parent = parent.getParent();
}
if ( null != topLevelModule )
{
if (topLevelModule.getBasedir().getAbsolutePath().length()
< parent.getBasedir().getAbsolutePath().length())
{
continue;
}
}
topLevelModule = parent;
}
if ( null == topLevelModule )
{
topLevelModule = project;
}
}

/* Empty report must be generated or top-level site will contain invalid link to non-existent Scoverage report
if ( scoverageDataDirs.isEmpty() )
{
Expand Down

0 comments on commit 73e91d1

Please sign in to comment.