You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Delany <de...@gmail.com> on 2023/02/05 19:08:01 UTC

xpath evaluation

Hi there,

Often people say to look at the effective-pom and therein lies the answer
to whatever question.
But the effective pom is huge. What if Maven could return an xpath
selection of the effective-pom?

Initially I thought the maven-help-plugin should do this. For instance, it
already returns XML some of the time

./mvnw -N help:evaluate -q -DforceStdout -Dexpression=project.repositories

 In this case I cant go deeper since there are multiple repository elements
and I need xpath.

./mvnw -N help:evaluate -q -DforceStdout
-Dxpath='/project/repositories/repository[id="maven-releases"]/snapshots/updatePolicy/text()'

The thing is I was hoping to print this information out using the
echo-maven-plugin, so I have a property

"snapshots repository update interval: ${snapshots-update-interval}"

I've already made so many properties for this sort of thing, it just seems
about time for an xpath function.

"snapshots repository update interval:
$#{/project/repositories/repository[id="maven-releases"]/snapshots/updatePolicy/text()}"

Thanks,
Delany