Skip to content

Missing <reporting> section in pom.xml - cannot generate unified Maven site reports #197

@sfloess

Description

@sfloess

Problem

pom.xml has excellent analysis tools configured (JaCoCo, SpotBugs, PMD, Checkstyle, PIT) but lacks a <reporting> section. This prevents generating a unified HTML site with all reports via mvn site.

Current State

Tools Configured in

  • ✅ JaCoCo (coverage): 0.8.12
  • ✅ SpotBugs (static analysis): 4.9.8.3
  • ✅ PMD (code quality): 3.25.0
  • ✅ Checkstyle (style): 3.6.0
  • ✅ PIT (mutation testing): 1.17.3
  • ✅ OWASP Dependency Check: 10.0.4
  • ✅ Maven Enforcer: 3.6.3

What's Missing

No <reporting> section in pom.xml

Impact

Cannot Generate Maven Site

mvn site
# Generates site but with minimal reports
# Missing: JaCoCo, SpotBugs, PMD, Checkstyle reports

No Unified HTML Dashboard

  • Each tool runs individually
  • Reports scattered: target/jacoco/, target/spotbugs/, etc.
  • No single page showing all quality metrics
  • Harder to review comprehensive quality status

CI/CD Gap

  • Cannot publish unified site to GitHub Pages
  • Cannot deploy consolidated reports
  • Each tool's output separate

Recommended Solution

Add Section to pom.xml

<reporting>
    <plugins>
        <!-- JaCoCo Coverage Report -->
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${jacoco.version}</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>report</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>

        <!-- SpotBugs Report -->
        <plugin>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-maven-plugin</artifactId>
            <version>4.9.8.3</version>
            <configuration>
                <effort>Max</effort>
                <threshold>Low</threshold>
                <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
            </configuration>
        </plugin>

        <!-- PMD Report -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>3.25.0</version>
            <configuration>
                <linkXRef>true</linkXRef>
                <sourceEncoding>utf-8</sourceEncoding>
                <minimumTokens>100</minimumTokens>
            </configuration>
        </plugin>

        <!-- Checkstyle Report -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>3.6.0</version>
            <configuration>
                <configLocation>google_checks.xml</configLocation>
            </configuration>
        </plugin>

        <!-- Maven Project Info Reports -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>3.9.0</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>index</report>
                        <report>summary</report>
                        <report>dependencies</report>
                        <report>dependency-info</report>
                        <report>team</report>
                        <report>licenses</report>
                        <report>scm</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>

        <!-- JavaDoc Report -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.12.0</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>javadoc</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>

        <!-- JXR (Source Cross-Reference) -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jxr-plugin</artifactId>
            <version>3.6.0</version>
        </plugin>
    </plugins>
</reporting>

Benefits After Implementation

Unified Quality Dashboard

mvn site
# Generates target/site/index.html with:
# - Code coverage (JaCoCo)
# - Bug analysis (SpotBugs)
# - Code quality (PMD)
# - Style violations (Checkstyle)
# - Dependencies
# - JavaDoc
# - Source cross-reference

Professional Project Site

  • Single entry point for all reports
  • Consistent navigation
  • Cross-linked reports
  • Professional appearance

CI/CD Enhancement

Can deploy site to GitHub Pages:

- name: Generate Maven Site
  run: mvn site site:stage

- name: Deploy to GitHub Pages
  uses: peaceiris/actions-gh-pages@v4
  with:
    publish_dir: ./target/staging
    destination_dir: site

Developer Experience

  • One command: mvn clean verify site
  • Open: target/site/index.html
  • Review all quality metrics in one place

Comparison with Similar Projects

Apache Commons Lang

Google Guava

  • ✅ Uses reporting plugins
  • Site available with all metrics

jcommons (Current)

  • ❌ No <reporting> section
  • ❌ No unified site
  • Tools run individually only

Implementation Steps

  1. Add <reporting> section to pom.xml after <build>
  2. Test site generation: mvn clean verify site
  3. Review output: Open target/site/index.html
  4. Verify all reports: Check jacoco, spotbugs, pmd, checkstyle tabs
  5. Optional: Configure site deployment to GitHub Pages

Verification

# Generate site
mvn clean verify site

# Check generated files
ls -la target/site/
# Should include: jacoco/, spotbugs.html, pmd.html, checkstyle.html

# Open in browser
open target/site/index.html
# Or: xdg-open target/site/index.html (Linux)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions