# Share a PMD HTML Report — Java Static Analysis Someone Actually Reads

Canonical: https://commareports.com/share-pmd-report
Published: 2026-08-31

> pmd check -f html writes a browsable violations report. Publish it to Comma for a URL with anchored threads per rule and a revision per run.

# Share a PMD HTML report

PMD has been telling Java teams about their `CyclomaticComplexity` since
before most of the code it analyzes was written. The findings are useful. The
delivery mechanism — a file under `target/site/` on a build agent — is why
nobody looks at them.

## Write the report

Standalone:

```bash
pmd check -d src/main/java \
  -R rulesets/java/quickstart.xml \
  -f html -r pmd.html || true
```

Maven:

```bash
mvn pmd:pmd          # → target/site/pmd.html
```

Gradle's `pmd` plugin writes `build/reports/pmd/main.html`.

The `|| true` matters in a report step — PMD exits non-zero when it finds
violations, which is every run you care about.

## Publish it

Drag the HTML into [the app](https://commareports.com/), or from CI:

```bash
curl -fsS -X PATCH "https://commareports.com/api/v1/reports/$REPORT_ID" \
  -H "Authorization: Bearer $COMMA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --rawfile html pmd.html \
        --arg title "PMD — $(git rev-parse --short HEAD)" \
        '{title: $title, html: $html}')"
```

If the report references a stylesheet (the Maven site variant does), drag the
folder rather than the single file and the references are rewritten to the
uploaded assets.

## Keep the gate separate

```groovy
// Gradle: the gate fails the build
pmd { ignoreFailures = false }
```

```yaml
- name: PMD report
  if: always()
  run: mvn -q pmd:pmd
```

A red gate with no readable artifact is the failure mode worth engineering
around.

## What review adds

- **Anchored threads** on a rule cluster — ownership, suppressions and the
  reasoning behind them, sitting on the evidence. See
  [commenting on HTML](/comment-on-html).
- **Revisions**, so "we cut priority-1 violations in half" is a diff, not a
  claim.
- **Access per report** — private, team, domain-gated, or named reviewers.
  See the [sharing model](/docs/sharing).

## Limits

- **Entry HTML: 5 MB.** Assets: 25 MB per file, 250 MB and 500 files total.
- **60 requests/minute per token.**

## Try it

Comma is free — unlimited reports, unlimited commenters, unlimited revision
history.

**[Publish an analysis report →](https://commareports.com/)**

### Related

- [Share a Checkstyle report](/share-checkstyle-report) · [Share a SpotBugs report](/share-spotbugs-report)
- [Share a Maven site report](/share-maven-site-report) · [Share a SonarQube report](/share-sonarqube-report)
- [Publish from CI](/docs/ci) · [Share a Detekt report](/share-detekt-report)
