Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
Use Case
User has source files or resources files where Maven properties like ${project.version} or ${project.name} need to be replaced with their actual value.
Examples:
- a REST API specification in src/site/resource/openapi.yaml
- the title of a Markdown document describing the project (like Maven Site Plugin's own documentation)
Workaround
Usually, it is recommended to add the .vm suffix to the files that need filtering, so that they are processed as a Velocity template.
But this workaround has several drawbacks:
- Velocity and Markdown formats are highly incompatible because of the headings format
- Velocity has 1000 times more features than just filtering, which is great, but also which can unexpectedly conflict with source files and with resource files (which may be from external sources, like JS libraries, YAML, etc.)
- .vm files are handled as Velocity templates in most code editors (VSCode, etc.), which prevents any other advanced features from working (especially on openapi.yaml, where you can have linting, validation, autosuggest, etc.)
Basically, Velocity templates is a great feature that needs to stay, but it's overkill for just replacing ${project.version} in a bunch of files.
Specifications
Add options to filter site source files and resource files:
- boolean sourceFiltering (default: false)
- boolean resourceFiltering (default: false)
- List<String> nonFilteredFileExtensions (default: jpg, jpeg, gif, bmp, png)
- boolean fileNameFiltering (default: false)
Use Maven's filtering component:
@Component(role = MavenResourcesFiltering.class, hint = "default") private MavenResourcesFiltering mavenResourcesFiltering;
.vm files don't need to be filtered. There are therefore 3 cases:
- no filtering
- simple filtering (like Maven Resource Plugin)
- advanced templating
Attachments
Issue Links
- duplicates
-
DOXIA-677 Macro for printing project properties
-
- Open
-