POM_XPATH_REMOVE(7)
π POM_XPATH_REMOVE(7) π
okay bestie, gather round, because pom_xpath_remove is that girl π
β she's the Java Packages Tools macro that deletes nodes out of XML files. yes, literally removes them. gone. no cap. let's get into it β¨
πΈ NAME πΈ
pom_xpath_remove β remove a node from XML file ποΈβ¨
π SYNOPSIS π
%pom_xpath_remove [OPTIONS] XPath [XML-file-location]...
like, XPath first, then however many file locations you want. she's flexible fr fr π«Ά
β¨ OPTIONS β¨
-rβ recursive mode, periodt. the given node also gets removed from all enabled submodules of the given POM file(s). important tho: this has no effect if the file is not a Maven POM π-fβ do NOT throw an error when one of the specified files doesn't contain the given node. she's chill like that π
π¦ DESCRIPTION π¦
so this macro patches the specified POM file and removes all XML nodes described by the XPath expression. and bestie, it doesn't stop at elements β this also works on attributes and text nodes π₯
XPath is the expression describing the set of XML nodes to be removed from the POM file. it must be a properly formatted XPath 1.0 expression, as described in http://www.w3.org/TR/xpath/ π
Maven POM files use a 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). iykyk π
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's root element. so if the document begins with <root xmlns:my="myurl.com"> you would select the root node with XPath expression /my:root. and if the document specifies a default namespace (eg xmlns="myurl.com") use the prefix named default to access elements in that namespace. cute right? π
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 the current working directory is used. when both pom.xml and ivy.xml are present, pom.xml is processed. you can specify more file locations, queen, go off π
π EXAMPLES π
%pom_xpath_remove pom:project/pom:reporting β this call removes the reporting section from the POM in the current working directory. main character behavior β¨
%pom_xpath_remove 'ivy:configure' build.xmlβ this call disables loading of ivy configuration inbuild.xmlfile. note the use of theivynamespace which was declared in the document asxmlns:ivy="antlib:org.apache.ivy.ant". see, told you the namespace thing mattered π§
π AUTHOR π
Written by Mikolaj Izdebski. king behavior π
π REPORTING BUGS π
Bugs should be reported through the Java Packages Tools issue tracker at Github: https://github.com/fedora-java/javapackages/issues. please tell them, don't suffer in silence bestie π«Ά
β SEE ALSO β
pom_add_dep(7), pom_add_parent(7), pom_add_plugin(7), pom_disable_module(7), pom_remove_dep(7), pom_remove_parent(7), pom_remove_plugin(7), pom_change_dep(7), pom_set_parent(7), pom_xpath_inject(7), pom_xpath_replace(7), pom_xpath_set(7).
the whole friend group honestly π«π
JAVAPACKAGES πΈ 2025-09-19 πΈ POM_XPATH_REMOVE(7)
and that's the tea, bestie β go remove some nodes, you're gonna eat π β¨π
π¦ where this page comes from
- fedora 43: javapackages-common 6.4.1-4.fc43 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms