Skip to content

Skip resource filtering when no resources are configured - #520

Merged
gnodet merged 1 commit into
apache:masterfrom
efegokdemir:codex/issue-311-skip-empty-resources
Sep 29, 2026
Merged

gnodet merged 1 commit into
apache:masterfrom
efegokdemir:codex/issue-311-skip-empty-resources

Conversation

@efegokdemir

Copy link
Copy Markdown

Summary

Avoid invoking the resource filtering component when the project has no resources configured. This prevents the misleading Copying 0 resource log entry described in #311 while preserving normal filtering for configured resources.

An integration fixture covers the empty-resource configuration and asserts that the zero-resource message is absent.

Fixes #311

Testing

  • mvn -Dspotless.skip=true -DskipTests=false test — passed (24 tests)
  • Checkstyle, RAT, and git diff --check — passed
  • mvn -Prun-its -Dinvoker.test=empty-resources -Dspotless.skip=true -DskipTests=false verify — blocked locally because Maven 3.9.16 does not satisfy this branch’s Maven 4.0.0-rc-6 prerequisite

Spotless was skipped because the repository formatter is not available for the local toolchain.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution — the idea is right (skip unnecessary work when no resources are configured). Two issues need to be addressed before this can be merged.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Comment thread src/it/empty-resources/verify.groovy Resolved

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All three findings from the previous review are addressed:

  1. verify.groovy — assertion now checks for the new "No resources configured, skipping." log message, which is only emitted by the guard. Effective and distinguishes fixed from unfixed behavior.
  2. invoker.properties — removed the incorrect invoker.maven.version = 3.0+. The IT now inherits the project default, consistent with the other ITs in this repo.
  3. ResourcesMojo.java — info log added in the early-return branch, matching the suggestion.

The guard correctly applies to all three mojo subclasses (ResourcesMojo, TestResourcesMojo, CopyResourcesMojo) via inheritance.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New commit 2edcac1 fixes the IT to actually exercise the early-exit guard: without <resources /> in the POM, Maven's Super POM provides a default src/main/resources root, so getResources().isEmpty() was never true and the skip path was untested. With the explicit empty <resources />, the IT now correctly triggers the guard and asserts the skip message. All three findings from the initial review remain addressed.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet gnodet added this to the 4.0.0-beta-2 milestone Sep 28, 2026
@gnodet gnodet added enhancement New feature or request java Pull requests that update Java code labels Sep 29, 2026
@gnodet
gnodet force-pushed the codex/issue-311-skip-empty-resources branch from cae522e to 5db0624 Compare September 29, 2026 09:23
…onfigured

- Return early from ResourcesMojo when the resources list is empty or null
- Add debug log message so the early exit is observable
- Add integration test verifying no output is produced for empty resources
@gnodet
gnodet force-pushed the codex/issue-311-skip-empty-resources branch from 5db0624 to ba47b5e Compare September 29, 2026 09:26
@gnodet
gnodet merged commit 3de1ef0 into apache:master Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MRESOURCES-307] Copying 0 resource

3 participants