1POM_XPATH_INJECT(7) Java Packages Tools POM_XPATH_INJECT(7)
2
3
4
6 pom_xpath_inject - inject code into XML file
7
9 %pom_xpath_inject XPath XML-code [XML-file-location]...
10
12 This macro patches specified XML file appending given code as children
13 of all XML nodes described by the XPath expression.
14
15 XPath is an expression describing a set of XML nodes in the XML file to
16 which child code is to be appended. It must be a properly formated
17 XPath 1.0 expression, as described in http://www.w3.org/TR/xpath/.
18
19 Maven POM files use specific XML namespace
20 http://maven.apache.org/POM/4.0.0 as default. This namespace needs to
21 be explicitly specified in XPath expressions by prefixing all node
22 names with pom: (i.e. pom:modelVersion).
23
24 Many other XML formats also use namespaces which you have to explicitly
25 specify. This script will use the namespace prefix names from the xmlns
26 declarations in the document’s root element. So if the document begins
27 with <root xmlns:my="myurl.com"> you would select the root node with
28 XPath expression /my:root. If the document specifies a default
29 namespace (e.g. xmlns="myurl.com") use the prefix named default to
30 acces elements in that namespace.
31
32 XML location can be either a full path to the XML, or a path to the
33 directory containing pom.xml or ivy.xml. If XML location is not given
34 then pom.xml or ivy.xml from current working directory is used. When
35 both pom.xml and ivy.xml are present, pom.xml is processed. You can
36 specify more file locations.
37
39 %pom_xpath_inject pom:project "<packaging>war</packaging>" - this call
40 sets packaging of POM in current working directory to war.
41
42 %pom_xpath inject configurations '<conf name="test"/>' - this adds a
43 new configuration to the Ivy file in current working directory.
44
46 Written by Mikolaj Izdebski.
47
49 Bugs should be reported through Java Packages Tools issue tracker at
50 Github: https://github.com/fedora-java/javapackages/issues.
51
53 pom_add_dep(7), pom_add_parent(7), pom_add_plugin(7),
54 pom_disable_module(7), pom_remove_dep(7), pom_remove_parent(7),
55 pom_remove_plugin(7), pom_change_dep(7), pom_set_parent(7),
56 pom_xpath_remove(7), pom_xpath_replace(7), pom_xpath_set(7).
57
58
59
60JAVAPACKAGES 07/28/2020 POM_XPATH_INJECT(7)