Fork me on GitHub

Filtering

Overview

The package goal supports filtering (i.e. placeholder replacement) similar to the maven-resources-plugin in arbitrary package source files.

As filtering may destroy binary files you should make sure that filtering is only applied to textual files.

Configuration

You need to set plugin parameter enableJcrRootFiltering and/or enableMetaInfFiltering to true to enable filtering at all.

There are several other parameters which allow to further tweak the filtering behavior.

An example configuration which enables filtering on all .content.xml files in the jcr root source folder looks like this:

<plugin>
  <groupId>org.apache.jackrabbit</groupId>
  <artifactId>filevault-package-maven-plugin</artifactId>
  <version>1.4.0-SNAPSHOT</version>
  <executions>
    <execution>
      <!-- default execution id for primary artifact: https://maven.apache.org/guides/mini/guide-default-execution-ids.html#default-executionids-for-implied-executions -->
      <id>default-package</id>
      <configuration>
        <enableJcrRootFiltering>true</enableJcrRootFiltering><!--only enable filtering on jcr root source files-->
        <filterFiles>
          <!-- additional properties file specifying keys and values -->
          <filterFile>filter.properties</filterFile>
        </filterFiles>
        <!-- only enable filtering on .content xml files -->
        <filteredFilePatterns>
          <filteredFilePattern>**/.content.xml</filteredFilePattern>
        </filteredFilePatterns>
      </configuration>
    </execution>
  </executions>
</plugin>

Filtering Extensions

Extensions allow to improve the simple placeholder replacement offered by Maven with domain specific features (useful for content packages). All features are opt-in and need to be explicitly enabled with a dedicated expression(-prefix).

Standard Extensions

The following extensions ship with the filevault-package-maven-plugin

Extension Description Expression Usage Example Since
FileVault DocView XML Attribute Escaping Escapes the interpolated value of the suffix according to FileVault DocView Escaping Rules for using it inside XML attribute values. vltattributeescape.<suffix> <myNode myProperty="${vltattributeescape.customMavenProperty1}" /> 1.4.0

Custom Extensions

The filtering may be extended through JSR-330 annotated Sisu components implementing the interface org.apache.jackrabbit.filevault.maven.packaging.InterpolatorCustomizerFactory which creates a Consumer<Interpolator> for every Maven project. That callback is called whenever the interpolator has been created for filtering but before it is being applied. A InterpolatorCustomizerFactory usually registers additional InterpolationPostProcessors or ValueSources on the given Interpolator.

They need to be loaded as plugin dependencies.