Bugfix for 429 (Maven sourceDocuments configuration is optional)#431
Bugfix for 429 (Maven sourceDocuments configuration is optional)#431ascheman wants to merge 13 commits into
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request enhances the HTML Sanity Check Maven and Gradle plugins to automatically discover HTML files (including .htm extension) from the sourceDir when sourceDocuments is not explicitly configured. Key changes include:
- Auto-population of
sourceDocumentsfromsourceDirwhen not specified - Support for both
.htmland.htmfile extensions - Addition of a recursive file discovery mechanism for the Maven plugin
- Comprehensive test coverage for the new functionality
- Fixed a typo in method name (
defaultIndeFilenames→defaultIndexFilenames) - Updated documentation to reflect
.htmsupport
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
HtmlSanityCheckMojo.java |
Added findHtmlFiles() method to recursively discover HTML/HTM files and modified setupConfiguration() to auto-populate sourceDocuments |
HtmlSanityCheckMojoTest.java |
Added comprehensive test suite covering HTTP status code configuration, file discovery scenarios, and edge cases |
HtmlSanityCheckTask.groovy |
Added .htm file pattern to Gradle plugin's auto-population logic |
HtmlSanityCheckTaskSpec.groovy |
Added test to verify .htm files are included in auto-population |
Configuration.java |
Fixed typo in method name from defaultIndeFilenames to defaultIndexFilenames |
htmlSanityCheck-maven-plugin/README.adoc |
Updated documentation to reflect .htm support and corrected XML tag name |
htmlSanityCheck-gradle-plugin/README.adoc |
Updated documentation to reflect .htm support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test Results123 files ± 0 123 suites ±0 3m 39s ⏱️ +17s For more details on these failures, see this check. Results for commit 88a6ffd. ± Comparison against base commit 0c70c6f. This pull request removes 60 and adds 34 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
b474f66 to
2d1b66c
Compare
|
testcontainers 1.20.6 -> 1.21.4 — Docker Desktop detection. gradle-git-properties 2.5.3 -> 2.5.4 — Git worktree support.
Maven groupId and all artifactIds are now lowercase, aligning with
Maven conventions and unblocking publication to repositories that
enforce this (notably GitHub Packages).
Old -> New:
Group org.aim42.htmlSanityCheck -> org.aim42.htmlsanitycheck
Gradle plugin id 'org.aim42.htmlSanityCheck' -> id 'org.aim42.htmlsanitycheck'
All artifacts htmlSanityCheck-* -> htmlsanitycheck-*
Internal Gradle project directories (htmlSanityCheck-core/, etc.) and
DSL closure names (htmlSanityCheck { ... }) are unchanged for
readability; only the published coordinates differ.
Each subproject sets base.archivesName explicitly to its lowercase
artifactId; the root maven-publish config picks that up via
artifactId = project.base.archivesName.get().
CHANGELOG carries the migration table with links to the historical
CamelCase artifacts on Maven Central and the Gradle Plugin Portal.
Plugin READMEs gain a prominent [IMPORTANT] admonition pointing at
issue #432 and showing the historical URLs.
The lowercase coordinates introduced by #432 are not yet on the Gradle Plugin Portal or Maven Central — HSC's BrokenHttpLinksChecker would fail self-check and the integration tests on the new badge/canonical URLs in our READMEs and CHANGELOG. Exclude them with grep-able TODO(#432) markers so the cleanup after the first release under the lowercase coords is a pure revert: grep -rn 'TODO(#432)' integration-test self-check
Add a maven repository named 'GitHubPackages' under publishing
{ repositories { } } so all four artifacts (core, gradle-plugin,
gradle-plugin marker, maven-plugin) can be pushed to
https://maven.pkg.github.com/aim42/htmlSanityCheck.
The repo is only registered when GITHUB_USER and GITHUB_TOKEN are
both set in the env — that way running 'publish' tasks that target
other repositories (mavenLocal, the local integration repo) keeps
working without env vars, and a missing-PAT mistake yields a clear
"task not found" instead of Gradle's cryptic "property
'credentials.username' doesn't have a configured value".
Plugin READMEs gain a "Development versions" section that recommends
GitHub Packages and deprecates JitPack. publishing.adoc gains a
GitHub Packages credentials section and a 'Publish development
snapshot to GitHub Packages' how-to step.
Feature and bugfix branches now publish under their own
branch-slug-SNAPSHOT (e.g. feature-432-add-gh-packages-SNAPSHOT)
so GitHub Packages can hold multiple in-flight branches in parallel
without colliding on a single 2.0.0-rcN coordinate.
Mechanism:
- Add me.qoomon.git-versioning 6.4.4. For refs matching
^(feature|bugfix)/.+ derive version = ${ref}-SNAPSHOT; for tags
v<version> derive a release version; otherwise fall back to
gradle.properties.
- Add a tiny root :printVersion task so shell callers (generate-
pages, CI) can capture the derived version without parsing build
output.
- Propagate -PhtmlSanityCheckVersion to the integration-test child
Gradle so the gradle-plugin integration test asks for the just-
published SNAPSHOT, not the static 2.0.0-rcN.
- generate-pages now captures printVersion and forwards it via -P
to self-check, so the CI doc-build picks up the SNAPSHOT plugin
instead of trying to resolve the static version that has not
been published yet.
SNAPSHOT-resolution plumbing for embedded/integration Maven:
Gradle's publishToRepository writes Maven layout but no
_remote.repositories markers, so Maven's
EnhancedLocalRepositoryManager refuses to resolve SNAPSHOTs that
simply appear in localRepository. Fix both Maven invocations
(htmlSanityCheck-maven-plugin build-time descriptor generation, and
integration-test/maven-plugin) by:
- declaring build/maven-repo as a 'remote' <repositories> /
<pluginRepositories> entry with a file:// URL, so Maven goes
through its download path and writes the origin markers
- pointing localRepository at a separate .gradle/maven-local-cache
so the cache lives outside build/ (and survives gradle clean,
avoiding re-downloading the Maven plugin toolchain on every
clean build)
The build-time pom.xml gets the absolute repo URL via a
mavenBuildRepoUrl expand binding in generatePom; the integration-
test pom.xml uses Maven's ${project.basedir} since it's loaded
directly.
Daily scheduled workflow that deletes htmlsanitycheck-* SNAPSHOT
versions on GitHub Packages whose branch no longer exists on origin
AND that are older than ORPHAN_RETENTION_DAYS (28).
Policy:
- Release versions (anything not ending in -SNAPSHOT) are NEVER
deleted.
- SNAPSHOTs whose branch still exists on origin are kept regardless
of age. So an active long-lived feature branch retains all its
snapshot history.
- SNAPSHOTs from removed branches stay in a 4-week grace window
before deletion — covers "I deleted the branch but a colleague
still consumes the artifact."
Implementation:
- Slugify active remote branches the same way git-versioning does
(slashes -> dashes) so 'feature/432-…' matches version
'feature-432-…-SNAPSHOT'.
- Iterate the 5 published artifacts (core, cli, gradle-plugin,
maven-plugin, gradle-plugin marker).
- Use the auto-injected secrets.GITHUB_TOKEN — no PAT required.
- workflow_dispatch with a 'dry-run' input for safe tuning before
enabling production deletes.
Replaces the simpler 'actions/delete-package-versions' approach with
branch-awareness: active branches never lose snapshot history, dead
branches age out cleanly.
Add a publish-gh-packages job to gradle-build.yml that runs after build-artifacts succeeds and pushes all four artifacts plus the plugin marker to GitHub Packages. Triggers only on push events to feature/* or bugfix/* branches — those are the refs git-versioning rewrites to <slug>-SNAPSHOT coordinates. develop and main fall through to gradle.properties' static 2.0.0-rcN and would conflict with already-published release versions, so we skip them here. The job uses the auto-injected secrets.GITHUB_TOKEN (no PAT needed for in-repo publishing) and github.actor as the username. The conditional credential block in build.gradle picks them up; without the env vars set (e.g. on PRs from forks) the GitHubPackages repo isn't registered and the job's gradle invocation would be a no-op, but the 'if:' gate prevents that path from running at all.
SonarCloud's GitHub Actions rule S7637 flags `uses: …@<tag>` as a supply-chain risk: a compromised tag could rewrite the action's implementation on the next workflow run. Pin to the commit SHA the v4 tag points at today (gradle/actions v4.4.3, commit 48b5f213c81028ace310571dc5ec0fbbca0b2947) and keep a trailing `# v4.4.3` comment so the version stays human-readable. Without this, the bugfix/405 PR analysis hits sonar.qualitygate.wait on the unreviewed-new-hotspot metric and fails the build.
Auto-populate sourceDocuments from sourceDir when not explicitly configured, matching the behavior of Gradle plugin and CLI. - Add findHtmlFiles() method to recursively scan for .html files - Modify setupConfiguration() to auto-populate when sourceDocuments is null - Add integration test executeWithOnlySourceDir_ShouldSucceed() - All existing tests pass without regression 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Rename defaultIndeFilenames to defaultIndexFilenames 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Update Gradle and Maven plugins to automatically search for both .html and .htm files when sourceDocuments is not specified. - Gradle plugin: Add .htm pattern to fileTree includes - Maven plugin: Update findHtmlFiles() to check for .htm extension - Update README.adoc in both plugins to document default behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add tests to verify both .html and .htm files are discovered when sourceDocuments is auto-populated from sourceDir. - Maven plugin: Test verifies 3 files (.htm, .html, nested .htm) - Gradle plugin: Test verifies same file discovery pattern - Both tests confirm recursive directory scanning works for .htm - Fix Maven README: Use correct <sourceDocument> element name - All tests pass with no regressions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Increases test count from 10 to 18 tests to improve SonarCloud coverage for HtmlSanityCheckMojo. - Add tests for HTTP status code overrides (success/error/warning) - Add tests for findHtmlFiles() edge cases (null, non-existent, empty) - Verify non-HTML files are properly ignored - Refactor setField() helper to shared static method
2d1b66c to
88a6ffd
Compare
|



The Maven source document configuration should be optional (it was mandatory as it seems).
This closes #429