Uploaded image for project: 'Maven Site Plugin'
  1. Maven Site Plugin
  2. MSITE-869

Options to preprocess site sources and resources through Maven filtering

    XMLWordPrintableJSON

Details

    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:

      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:

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bertrandmartin Bertrand Martin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: