Skip to content

Render project .vm overrides with Velocity when useProjectFiles is set (#267) - #282

Open
elharo wants to merge 1 commit into
masterfrom
fix/issue-267-use-project-files-velocity
Open

Render project .vm overrides with Velocity when useProjectFiles is set (#267)#282
elharo wants to merge 1 commit into
masterfrom
fix/issue-267-use-project-files-velocity

Conversation

@elharo

@elharo elharo commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #267

Problem

When useProjectFiles is enabled, a resource override placed in the project
root is copied verbatim via FilteringUtils.copyFile, bypassing Velocity
processing. Unlike copyResourceIfExists, copyProjectRootIfExists also only
looked for <name>, never for the <name>.vm template variant, so .vm
overrides were silently ignored and the bundle template was used instead.

Changes

  • copyProjectRootIfExists now mirrors copyResourceIfExists:
    • checks for both <name> and <name>.vm in the project root
    • renders <name>.vm through Velocity (velocity.evaluate) with the bundle's
      source encoding, matching the behavior of bundle-resource templates
    • plain files are still copied verbatim

Tests

  • New test testUseProjectFilesRendersVelocityTemplate: writes a local
    <basedir>/FILTER.txt.vm containing $project.name, sets useProjectFiles
    and asserts the output FILTER.txt contains the rendered project name.
  • Verified the test fails without the fix and passes with it; full mvn verify
    (incl. spotless/checkstyle/RAT) passes.

@elharo
elharo requested a review from slawekjaranowski August 2, 2026 13:05
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.

useProjectFiles bypasses Velocity rendering for .vm overrides

1 participant