elharo opened a new issue, #267:
URL: https://github.com/apache/maven-remote-resources-plugin/issues/267
## Summary
`copyProjectRootIfExists()` copies a project file over a remote bundle
resource with a plain, un-rendered copy — no Velocity processing. When a local
file overrides a remote `.vm` template, the raw Velocity syntax is emitted into
the output.
`src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java:666-679`
```java
private boolean copyProjectRootIfExists(File outputFile, String
bundleResourceName) throws IOException {
if (!useProjectFiles) {
return false;
}
File source = new File(project.getBasedir(), bundleResourceName);
if (source.exists()) {
getLog().debug("Use project file + source + as resource");
FilteringUtils.copyFile(source, outputFile, null, null);
return true;
}
return false;
}
```
## Problems
1. The copy uses `FilteringUtils.copyFile(source, outputFile, null, null)` —
no Velocity `mergeTemplate`/`evaluate`. A remote `.vm` template (`foo.txt.vm`)
overridden by a local `foo.txt` will be copied verbatim, leaving
`$project.name` etc. unexpanded in the output.
2. It only looks for `<basedir>/<name>`, ignoring `<basedir>/<name>.vm` —
inconsistent with `copyResourceIfExists()` (`:614-664`) which checks both
`<name>` and `<name>.vm` and renders the `.vm` variant via Velocity.
This feature is new in 3.3.0, so the inconsistency vs. the established
resource-directory override path is surprising.
## Suggested fix
Mirror the logic of `copyResourceIfExists()`: check for both `<name>` and
`<name>.vm`, and when the `.vm` file is used, render it through
`velocity.evaluate(...)` with the same encoding handling.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]