1POM_XPATH_REPLACE(7) Java Packages Tools POM_XPATH_REPLACE(7)
2
3
4
6 pom_xpath_replace - replace XML node from XML file with given code
7
9 %pom_xpath_replace XPath XML-code [XML-file-location]...
10
12 -r
13 Work in recursive mode. That means that given node is also replaced
14 in all enabled submodules of given POM file(s). Has no effect if
15 the file is not Maven POM.
16
17 -f
18 Do not throw an error when one of the specified files doesn’t
19 contain given node.
20
22 This macro patches specified POM file removing all XML nodes described
23 by the XPath expression and injecting given XML code in their place.
24
25 XPath is an expression describing a set of XML nodes to be removed from
26 the POM file. It must be a properly formated XPath 1.0 expression, as
27 described in http://www.w3.org/TR/xpath/.
28
29 Maven POM files use specific XML namespace
30 http://maven.apache.org/POM/4.0.0 as default. This namespace needs to
31 be explicitly specified in XPath expressions by prefixing all node
32 names with pom (i.e. pom:modelVersion).
33
34 Many other XML formats also use namespaces which you have to explicitly
35 specify. This script will use the namespace prefix names from the xmlns
36 declarations in the document’s root element. So if the document begins
37 with <root xmlns:my="myurl.com"> you would select the root node with
38 XPath expression /my:root. If the document specifies a default
39 namespace (eg xmlns="myurl.com") use the prefix named default to acces
40 elements in that namespace.
41
42 XML location can be either a full path to the XML, or a path to the
43 directory containing pom.xml or ivy.xml. If XML location is not given
44 then pom.xml or ivy.xml from current working directory is used. When
45 both pom.xml and ivy.xml are present, pom.xml is processed. You can
46 specify more file locations.
47
49 Written by Mikolaj Izdebski.
50
52 Bugs should be reported through Java Packages Tools issue tracker at
53 Github: https://github.com/fedora-java/javapackages/issues.
54
56 pom_add_dep(7), pom_add_parent(7), pom_add_plugin(7),
57 pom_disable_module(7), pom_remove_dep(7), pom_remove_parent(7),
58 pom_remove_plugin(7), pom_change_dep(7), pom_set_parent(7),
59 pom_xpath_inject(7), pom_xpath_remove(7), pom_xpath_set(7).
60
61
62
63JAVAPACKAGES 01/29/2020 POM_XPATH_REPLACE(7)