Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8113293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:46:49+00:00 2026-06-06T02:46:49+00:00

I am working on pom file modifications to change the version node value. I

  • 0

I am working on pom file modifications to change the version node value. I can get xpath to modify all version nodes, but I only want it to change the version node when both the artifactId and classifier match certain values. Here is my xml:

<artifactItem>
    <groupId>com.xyz</groupId>
    <artifactId>foobar</artifactId>
    <version>${project.version}</version>
    <classifier>config</classifier>
    <type>zip</type>
    <overWrite>true</overWrite>
</artifactItem>
<artifactItem>
    <groupId>com.xyz</groupId>
    <artifactId>foobar</artifactId>
    <version>${project.version}</version>
    <type>jar</type>
</artifactItem>

If artifactId is foobar, and classifier is config, I want version returned so I can modify it.

Using other examples I found, I tried this, but it didn’t work:

/artifactItem/artifactId[.='foobar']
     /following-sibling::*
      [count(.|/artifactItem/classifier[. ='config']/preceding-sibling::*)
      =
      count(/artifactItem/classifier[. ='config']/preceding-sibling::*)
      ] 

Any suggestions would be greatly appreciated!

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:46:51+00:00Added an answer on June 6, 2026 at 2:46 am
    //artifactItem[artifactId='foobar' and classifier='config']/version
    

    To explain:

    We are selecting the version node, from the artifactItem node that has an artifactId of ‘foobar’ AND a classifier of ‘config’.

    You use the brackets to qualify a particular node using sub-XPATH statements where the context is the node before the brackets.

    Is this what you are looking for?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to extract all the properties from my pom.xml into a properties-file. These
How can set the object type of a property in a pom file? I'm
This is a snippet of my pom file. ... <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.4</version>
I have a working or mostly working POM that fetches all and exactly just
Very new to maven. I have a pom file that I can use to
Can someone provide me a working example of pom.xml which is used to build
Working on joining up two legacy DB systems into new database where I can
I'm working with a pom that is of type pom. If the pom is
I have been working Quartz framework in my grails project with lib called quartz-all-1.7.3.
My maven reports are working great, all except Checkstyle and test xref. My test

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.