Linux repositories inspector

pom_xpath_replace(7)

JAVAPACKAGES
01/29/2020

javapackages-tools

Macros and scripts for Java packaging support

javapackages-local

Non-essential macros and scripts for Java packaging support

NAME

pom_xpath_replace - replace XML node from XML file with given code

SYNOPSIS

%pom_xpath_replace XPath XML-code [XML-file-location]...

OPTIONS

-r
Work in recursive mode. That means that given node is also replaced in all enabled submodules of given POM file(s). Has no effect if the file is not Maven POM.
-f
Do not throw an error when one of the specified files doesn\(cqt contain given node.

DESCRIPTION

This macro patches specified POM file removing all XML nodes described by the XPath expression and injecting given XML code in their place.
XPath is an expression describing a set of XML nodes to be removed from the POM file. It must be a properly formated XPath 1.0 expression, as described in \m[blue]http://www.w3.org/TR/xpath/\m[].
Maven POM files use specific XML namespace http://maven.apache.org/POM/4.0.0 as default. This namespace needs to be explicitly specified in XPath expressions by prefixing all node names with pom (i.e. pom:modelVersion).
Many other XML formats also use namespaces which you have to explicitly specify. This script will use the namespace prefix names from the xmlns declarations in the document\(cqs root element. So if the document begins with <root xmlns:my="myurl.com"> you would select the root node with XPath expression /my:root. If the document specifies a default namespace (eg xmlns="myurl.com") use the prefix named default to acces elements in that namespace.
XML location can be either a full path to the XML, or a path to the directory containing pom.xml or ivy.xml. If XML location is not given then pom.xml or ivy.xml from current working directory is used. When both pom.xml and ivy.xml are present, pom.xml is processed. You can specify more file locations.

AUTHOR

Written by Mikolaj Izdebski.

REPORTING BUGS

Bugs should be reported through Java Packages Tools issue tracker at Github: \m[blue]https://github.com/fedora-java/javapackages/issues\m[].
⇧ Top