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 in build.xml file. note the use of the ivy namespace which was declared in the document as xmlns: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