%maven.project.version% is '???' when read in build step
I am trying to set the buildNumber by modifying the project version in a Bash "custom script" as a "command line" build step. This is the first build step and the script starts off like this
#!/bin/bash
mvn_version=%maven.project.version%
echo "version is $mvn_version" #this prints out '???'
suffix="%build.counter%-SNAPSHOT"
echo "suffix is $suffix" #this prints out '40-SNAPSHOT'
new_version=${mvn_version/SNAPSHOT/$suffix}
echo "new build number is $new_version" #this prints out '???'
echo "##teamcity[buildNumber '$new_version']"
|
What do I need to do so %maven.project.version% is populated and not "???"?!
Please sign in to leave a comment.
Hi Kareem,
How do you define %maven.project.version% parameter in the build configuration? Please check the parameter value on build > Parameters page.
This is a TeamCity-owned parameter I do not set it. But when my first build step is of type Maven I can see in the log that the buildNumber is set first
The %maven.project.version% parameter is reported when Maven build step is running. Do you have Maven build step before running your bash script?
We're encountering this same issue -- there is a Maven step running a step before the command script that is attempting to echo %maven.project.version%. It writes out ???
Actually, disregard - the pom file path was missing /pom.xml -- TeamCity still found the pom file but did not read it as if it was given the full file path.