The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.
For a list of other such plugins, see the Pipeline Steps Reference page.
xmlEditBuilder: Edit XML file$VERSION are expanded in all fields.
file : String
file or files: setting both is an error.
operations
setText, upsert, setAttribute, removeAttribute, addElement, remove. Each one sees the result of the previous ones.
addElementxpath : String
fragment : String
expected : String (optional)
AT_LEAST_ONE (default), ONE, ANY (zero is fine) or an exact number such as 2. If the count does not match, the step fails and the file is not written.
position : String (optional)
LAST_CHILD (default), FIRST_CHILD, BEFORE or AFTER the selected element.
removeAttributexpath : String
name : String
expected : String (optional)
AT_LEAST_ONE (default), ONE, ANY (zero is fine) or an exact number such as 2. If the count does not match, the step fails and the file is not written.
removexpath : String
expected : String (optional)
AT_LEAST_ONE (default), ONE, ANY (zero is fine) or an exact number such as 2. If the count does not match, the step fails and the file is not written.
setAttributexpath : String
name : String
value : String
expected : String (optional)
AT_LEAST_ONE (default), ONE, ANY (zero is fine) or an exact number such as 2. If the count does not match, the step fails and the file is not written.
setTextxpath : String
value : String
< and & are escaped for you.
expected : String (optional)
AT_LEAST_ONE (default), ONE, ANY (zero is fine) or an exact number such as 2. If the count does not match, the step fails and the file is not written.
upsert/Project/PropertyGroup/Version, optionally with [@attribute='value'] predicates (the attributes are created too) and a final /@attribute step. The root element is never created.
xpath : String
/project/properties/revision or /configuration/appSettings/add[@key='Env']/@value.
value : String
expected : String (optional)
ANY (zero means "create"). Other values: ONE, AT_LEAST_ONE or an exact number.
dryRun : boolean (optional)
excludes : String (optional)
files.
files : String (optional)
**/*.csproj. All files are edited in memory first: if an operation fails on any file, no file is written. expected is checked for each file. Use exactly one of file or files: setting both is an error.
maxSizeMb : int (optional)
namespaces : String (optional)
m=http://maven.apache.org/POM/4.0.0. Prefixes declared in the document can be used without configuration. Binding a prefix to the default namespace of the document switches to standard XPath rules.
outputFile : String (optional)
showDiff : boolean (optional)
strictNamespaces : boolean (optional)
/project/version works on a Maven POM even though it declares xmlns="http://maven.apache.org/POM/4.0.0". Enable this option to apply standard XPath 1.0 rules; elements in the default namespace then need a prefix declared with namespaces. Binding a prefix to the default namespace URI with namespaces enables standard rules automatically.
xmlValidateBuilder: Validate XML filefile : String
maxSizeMb : int (optional)
schema : String (optional)
xs:include/xs:import are resolved only from files inside the workspace; remote locations are refused.
xmlEdit: Edit XML files (lossless)operations
setText, upsert, setAttribute, removeAttribute, addElement, remove. Each one sees the result of the previous ones.
addElementxpath : String
fragment : String
expected : String (optional)
AT_LEAST_ONE (default), ONE, ANY (zero is fine) or an exact number such as 2. If the count does not match, the step fails and the file is not written.
position : String (optional)
LAST_CHILD (default), FIRST_CHILD, BEFORE or AFTER the selected element.
removeAttributexpath : String
name : String
expected : String (optional)
AT_LEAST_ONE (default), ONE, ANY (zero is fine) or an exact number such as 2. If the count does not match, the step fails and the file is not written.
removexpath : String
expected : String (optional)
AT_LEAST_ONE (default), ONE, ANY (zero is fine) or an exact number such as 2. If the count does not match, the step fails and the file is not written.
setAttributexpath : String
name : String
value : String
expected : String (optional)
AT_LEAST_ONE (default), ONE, ANY (zero is fine) or an exact number such as 2. If the count does not match, the step fails and the file is not written.
setTextxpath : String
value : String
< and & are escaped for you.
expected : String (optional)
AT_LEAST_ONE (default), ONE, ANY (zero is fine) or an exact number such as 2. If the count does not match, the step fails and the file is not written.
upsert/Project/PropertyGroup/Version, optionally with [@attribute='value'] predicates (the attributes are created too) and a final /@attribute step. The root element is never created.
xpath : String
/project/properties/revision or /configuration/appSettings/add[@key='Env']/@value.
value : String
expected : String (optional)
ANY (zero means "create"). Other values: ONE, AT_LEAST_ONE or an exact number.
dryRun : boolean (optional)
excludes : String (optional)
files.
file : String (optional)
file, files or text: setting more than one is an error.
files : String (optional)
**/*.csproj. All files are edited in memory first: if an operation fails on any file, no file is written. expected is checked for each file. Use exactly one of file, files or text: setting more than one is an error.
maxSizeMb : int (optional)
namespaces (optional)
namespaces: [m: 'http://maven.apache.org/POM/4.0.0']. Prefixes declared in the document can be used without configuration.
java.util.Map<java.lang.String, java.lang.String>outputFile : String (optional)
showDiff : boolean (optional)
strictNamespaces : boolean (optional)
/project/version works on a Maven POM even though it declares xmlns="http://maven.apache.org/POM/4.0.0". Enable this option to apply standard XPath 1.0 rules; elements in the default namespace then need a prefix declared with namespaces. Binding a prefix to the default namespace URI with namespaces enables standard rules automatically.
text : String (optional)
text in the result map: def r = xmlEdit text: xml, operations: [...]; echo r.text. Use exactly one of file, files or text: setting more than one is an error.
xmlQuery: Query an XML file with XPathdef v = xmlQuery file: 'pom.xml', xpath: '/project/version'
xpath : String
/project/version, //dependency/artifactId or count(//testcase[failure]).
defaultValue : String (optional)
STRING, the value returned when the XPath matches nothing, instead of failing. It takes precedence over failIfNotFound.
failIfNotFound : boolean (optional)
STRING, fail when nothing matches (default). When disabled the step returns null.
file : String (optional)
file or text: setting both is an error.
maxSizeMb : int (optional)
namespaces (optional)
namespaces: [m: 'http://maven.apache.org/POM/4.0.0']. Prefixes declared in the document can be used without configuration.
java.util.Map<java.lang.String, java.lang.String>returnType : String (optional)
STRING (value of the first node, default), LIST (values of all nodes), NUMBER or BOOLEAN.
strictNamespaces : boolean (optional)
/project/version works on a Maven POM even though it declares xmlns="http://maven.apache.org/POM/4.0.0". Enable this option to apply standard XPath 1.0 rules; elements in the default namespace then need a prefix declared with namespaces. Binding a prefix to the default namespace URI with namespaces enables standard rules automatically.
text : String (optional)
file or text: setting both is an error.
xmlRead: Read an XML file into maps and lists@name, repeated elements become lists. Example: def pom = xmlRead file: 'pom.xml'; echo pom.version
file : String (optional)
file or text: setting both is an error.
maxSizeMb : int (optional)
namespaces (optional)
namespaces: [m: 'http://maven.apache.org/POM/4.0.0']. Prefixes declared in the document can be used without configuration.
java.util.Map<java.lang.String, java.lang.String>strictNamespaces : boolean (optional)
/project/version works on a Maven POM even though it declares xmlns="http://maven.apache.org/POM/4.0.0". Enable this option to apply standard XPath 1.0 rules; elements in the default namespace then need a prefix declared with namespaces. Binding a prefix to the default namespace URI with namespaces enables standard rules automatically.
text : String (optional)
file or text: setting both is an error.
xpath : String (optional)
xmlValidate: Validate an XML file (well-formedness, XSD)[valid: ..., errors: [[line:, column:, severity:, message:]]].
failOnError : boolean (optional)
file : String (optional)
file or text: setting both is an error.
maxSizeMb : int (optional)
schema : String (optional)
xs:include/xs:import are resolved only from files inside the workspace; remote locations are refused.
text : String (optional)
file or text: setting both is an error.
Please submit your feedback about this page through this quick form.
Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?
See existing feedback here.