View on GitHub

PME @ Red Hat

Standardize Your Builds

XML Manipulation

Overview

PME offers the ability to modify one or many xml files in the repository prior to running the build.

Warning : This should not be used to modify XML POM files within the Maven Model (as they will get overwriten by the POM Manipulator) but for e.g. assembly files.

Configuration

The manipulator is controlled by the xmlUpdate property. The format is

-DxmlUpdate=<file>:<xml-xpath-expression>:[<replacement-value>] [,....]

Multiple comma separated values may be supplied. If the replacement-value is not specified the operation becomes a delete rather than an update.

The format for the xpath-style expression is as used in XPath and in the specification here.

Note: Any ‘,’ or ‘:’ in the path expression or replacement value should be escaped with ‘\’.

As an example:

-DxmlUpdate='src/main/assembly/dep.xml://include[starts-with(.,'org.apache.tomcat')]:com.rebuild:servlet-api"'

This means: