0

I`ve got some (html) files which eventually have to be included to a WAR file. The files look like:

<html>
..
<!-- marker_id_start -->
.. html mark-up I want to keep...
<!-- marker_id_end -->
..
</html>

I`d like to transform content of each file cutting off everything before marker_id_start and after marker_id_end so the result file would look like:

<!-- marker_id_start -->
.. html mark-up I want to keep...
<!-- marker_id_end -->

or even just like

.. html mark-up I want to keep...

The transformation is part of war assembly process, so I thought I could use maven resource plugin with a custom filter. Obviously I would need to configure marker ids but I`m not sure how to do that and how to make these custom config options visible in my filter.

The only documentation I`ve found is this: https://maven.apache.org/plugins/maven-resources-plugin/examples/custom-resource-filters.html but it does not say much, only very basic things.

Any help is appreciated. Thanks.

Shake
  • 61
  • 1
  • Filtering isn't about removing parts of the file, but replacing tokens by a specific value at built-time. Why do you want to do this? – Tunaki Jun 28 '16 at 08:11
  • I guess removing is replacing with empty strings ;) – Shake Jun 28 '16 at 08:13

1 Answers1

0

According to Apache Maven Resources Plugin / Filtering filtering applies to:

variables, denoted by the ${...} delimiters

Have a look at the transform goal of the XML Maven Plugin:

  • xml:transform transforms XML files by applying XSLT stylesheets.
Gerold Broser
  • 14,080
  • 5
  • 48
  • 107