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 9232163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:14:56+00:00 2026-06-18T06:14:56+00:00

i am using maven2 , hudson and sonar while doing sonar analysis – i

  • 0

i am using maven2 , hudson and sonar
while doing sonar analysis – i would like some way to append the Hudson build# to the maven version of the project

The project version changes every 2 weeks – so take an example in the first 2 weeks :

<version>abc-SNAPSHOT</version>

after two weeks the next version could be something like :

<version>xyz-SNAPSHOT</version>

what I want is to append the build# to the version already present in pom – which is being picked up and passed to sonar

NOTE:

-Dsonar.projectVersion=xyz-SNAPSHOT-${BUILD_NUMBER}

Here – I am hardcoding the version and dynamically passing the build#

what I want is to be able to dynamically pick up the version from maven ( without changing it ) and simply appending the build# dynamically

any ideas of how this can be achieved ?
Thanks,
satish

  • 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-18T06:14:57+00:00Added an answer on June 18, 2026 at 6:14 am

    You can use Groovy script to read the version and put on environment variable:
    Getting Maven Version in Jenkins

    I used this script on time to parse the version:

    def project = new XmlParser().parse("/pom.xml")
    def artifactId =  project.artifactId.text().trim()
    def version = project.version.text().trim()
    println "ArtifactId: [" + artifactId + "]"
    println "Version: [" + version + "]"
    

    After set “Additional properties” field with:
    -Dsonar.projectVersion=${MAVEN_VERSION}-${BUILD_NUMBER}

    If Jenkins don’t get the variable, try install:
    https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

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

Sidebar

Related Questions

Have set up code analysis using sonar hudson and maven My plan is to
Im using maven to build a multi module project. But some projects are in
I have been using maven projects in hudson quite successfully for some time. However
I want to use hudson to build a maven-java project. Some of my integration
I would like to be able to publish snapshots to the repository using maven
I am using GWT , maven build tool, and Hudson tool for continuous integration.
I am using Sonar new version with Ant build connectint to Hudson. I get
I am using Maven (3.x) to build an Android application within Hudson. I use
I am using Maven (3.x) to build an Android application within Hudson. I use
I'm using Hudson to build a Java project w/ Maven. The project includes two

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.