Skip to content

Write the report to target/site when run without a pom.xml - #236

Open
askaks wants to merge 1 commit into
refactorfirst:mainfrom
askaks:pr/no-pom-report-folder
Open

askaks wants to merge 1 commit into
refactorfirst:mainfrom
askaks:pr/no-pom-report-folder

Conversation

@askaks

@askaks askaks commented Nov 17, 2026 •

Copy link
Copy Markdown

What this fixes

Run in a folder with no pom.xml, the Maven goals wrote the report into a folder literally named ${project.basedir}/target/site. This is the item I mentioned at the end of #235. It affects any repository without a pom.xml, which is how a C# repository is normally run.

Why it happened

With no pom.xml, Maven supplies a stub project whose super-POM defaults are not interpolated. MavenReportOutputDirectory received ${project.basedir}/target/site as the reporting output directory, and ${project.basedir}/target as the build directory, and used them as real paths.

The change

A directory value that still contains ${ is treated as not set, for the reporting output directory, the build directory parameter and the project's build directory. The existing target/site default then applies. Projects with a pom.xml take the same path as before.

Two files: MavenReportOutputDirectory and its test (4 new tests beside the existing 2).

How it was tested

  • The new tests failed before the change, showing the ${project.basedir} folder, and pass after it.
  • Full mvn -B verify passes locally.
  • A real run of htmlReport in a folder with no pom.xml now writes to target/site.

Not changed

In a folder with no pom.xml, -Dproject.build.directory=... is still not honoured: Maven fills that parameter from the stub project before the plugin sees it. Letting the user choose the folder there would need a differently named property, which I left for you to decide.

Not tried on Windows.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Report output paths now correctly fall back to target/site when reporting or build-directory settings are blank, missing, or unresolved placeholders.
    • When a valid build directory is provided, reports are saved in its site subdirectory.
    • Configured reporting output paths continue to be honored.

Run in a directory with no pom.xml, Maven supplies a stub project whose
super-POM defaults are not interpolated, so the report was written to a
folder literally named "${project.basedir}/target/site".

A directory value that still contains "${" is now treated as not set, for
the reporting output directory, the build directory parameter and the
project's build directory, and the usual target/site default applies.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The output directory resolver treats null, blank, and unresolved placeholder values as unset. Tests cover configured reporting paths and no-POM fallback paths.

Changes: Output Directory Resolution

Layer / File(s) Summary
Resolve output directories and validate fallback behavior
refactor-first-maven-plugin/src/main/java/org/hjug/mavenreport/MavenReportOutputDirectory.java, refactor-first-maven-plugin/src/test/java/org/hjug/mavenreport/MavenReportOutputDirectoryTest.java
The resolver treats null, blank, and placeholder-containing directory values as unset. Tests cover a configured reporting path, unresolved no-POM values, and a concrete build-directory parameter.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: jimbethancourt

Merge Risk: Minimal · up to a945c

Maven report goals run without a pom.xml now write to target/site instead of a literal unresolved placeholder path. Projects with a pom.xml follow the same path as before. The change is small and tested, and I see no merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main change: when the Maven report goal runs without a pom.xml, output goes to target/site. The change treats unresolved placeholder directory values (containing "${") as unset so…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: when the Maven report goal runs without a pom.xml, output goes to target/site. The change treats unresolved placeholder directory values (containing "${") as unset so the target/site default applies, which matches the title. The title is clear and specific, and it avoids vague terms.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 53ea17e and a945c1a.

Files selected for processing: 2

  • refactor-first-maven-plugin/src/main/java/org/hjug/mavenreport/MavenReportOutputDirectory.java
  • refactor-first-maven-plugin/src/test/java/org/hjug/mavenreport/MavenReportOutputDirectoryTest.java

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant