Here is the command which works in a git bash and fails in the pipeline.
No error messages in the log.
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout);
However this line works fine in both:
- PREVIOUS_VERSION=$(cat previous_version.txt);
Please advise.
Hi Victor,
Is there a property <version> in the pom.xml of your repo, at the commit that this build is running for? I can reproduce this error if the pom.xml doesn't have the <version> property for the <project>.
In case that property exists at the commit that this build is running for, I would suggest the following:
mvn help:evaluate -Dexpression=project.version -X -DforceStdout
Afterwards, you can post the output of the commands here so we can take a look.
It would also be useful to know the following:
Please feel free to let me know if you have any questions.
Kind regards,
Theodora
Thank you Theodora!
1. Yes, The version property is in pom-file.
<version>0.0.8-SNAPSHOT</version>
2. The build runs on Atlassian infrastructure and the image pulled by pipeline is
image: maven:3.6.3
3. I set -X, but still no joy. Here is the raw output.
**********************************************************************************
+ umask 000
+ GIT_LFS_SKIP_SMUDGE=1 retry 6 git clone --branch="azure-pipelines" --depth 50 https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIR
Cloning into '/opt/atlassian/pipelines/agent/build'...
+ git reset --hard 765842d2ee65f64ea9ae230bea06b18f20d49ce5
HEAD is now at 765842d minor bug fix. added verbosity in bitbucket pipeline
+ git config user.name bitbucket-pipelines
+ git config user.email commits-noreply@bitbucket.org
+ git config push.default current
+ git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://localhost:29418/
+ git remote set-url origin http://bitbucket.org/$BITBUCKET_REPO_FULL_NAME
+ git reflog expire --expire=all --all
+ echo ".bitbucket/pipelines/generated" >> .git/info/exclude
+ chmod 777 $BUILD_DIR
Default variables:
BITBUCKET_BRANCH
BITBUCKET_BUILD_NUMBER
BITBUCKET_CLONE_DIR
BITBUCKET_COMMIT
BITBUCKET_GIT_HTTP_ORIGIN
BITBUCKET_GIT_SSH_ORIGIN
BITBUCKET_PIPELINE_UUID
BITBUCKET_PROJECT_KEY
BITBUCKET_PROJECT_UUID
BITBUCKET_REPO_FULL_NAME
BITBUCKET_REPO_IS_PRIVATE
BITBUCKET_REPO_OWNER
BITBUCKET_REPO_OWNER_UUID
BITBUCKET_REPO_SLUG
BITBUCKET_REPO_UUID
BITBUCKET_SSH_KEY_FILE
BITBUCKET_STEP_RUN_NUMBER
BITBUCKET_STEP_TRIGGERER_UUID
BITBUCKET_STEP_UUID
BITBUCKET_WORKSPACE
CI
DOCKER_HOST
PIPELINES_JWT_TOKEN
Workspace variables:
AZURE_ARTIFACTS_PAT
CURRENT_VERSION
PREVIOUS_VERSION
Images used:
build : docker.io/library/maven@sha256:.......xx.xx.x.0a3df6
+ PREVIOUS_VERSION=$(cat previous_version.txt);
+ echo "Previous version $PREVIOUS_VERSION";
Previous version 0.0.8-SNAPSHOT
+ CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -X -DforceStdout);
Searching for test report files in directories named [test-results, failsafe-reports, test-reports, TestResults, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As you may see, there is no error message in the log ... It just fails on that line.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Victor,
Thank you for the info. I still cannot reproduce this error (unless the property is missing) when I use image: maven:3.6.3.
I can see in the build log that this build runs for the branch azure-pipelines. Could you please double-check if the property <version> is in the pom.xml of that branch? When viewing the source code of the repo on our website, there is a dropdown to switch branches right above the file list.
Could you also try my other suggestion by adding the following commands in the yml file's script? You can then post the output of the second command here.
- set -x
- CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout);
With the set -x, the second command may print any errors.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.