I have a typical pom.xml, and want to print the groupId, artifactId and version, separated by colon. I think that XMLStarlet is the right tool for that. I tried several ways, but I always get an empty line.
xml sel -t -m project -v groupId -o : -v artifactId -o : -v version pom.xml
Expected output:
org.something.apps:app-acct:5.4
Real output: empty line
Even if I try to print just the groupId I get nothing:
xml sel -t -v project/groupId pom.xml
I am sure that the tool sees the elements because I can list them without problem:
xml el pom.xml
prints the following (correctly):
project
project/modelVersion
project/parent
project/parent/groupId
project/parent/artifactId
project/parent/version
project/groupId
project/artifactId
project/version
project/packaging
What's wrong?
Here is the cut-down version of pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.something</groupId>
<artifactId>base</artifactId>
<version>1.16</version>
</parent>
<groupId>org.something.apps</groupId>
<artifactId>app-acct</artifactId>
<version>5.4</version>
<packaging>war</packaging>
</project>