Mvn : The term 'mvn' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again

I installed gitlab runner 12.7.1 version in my windows 10, 64 bit machine and I’m trying to create gitlab CI with sonarqube code quality analysis. But when I trigger the job it is saying,
mvn : The term ‘mvn’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

  • CategoryInfo : ObjectNotFound: (mvn:String) , CommandNotFoundException

31 + FullyQualifiedErrorId : CommandNotFoundException.

image: maven:latest-jdk-11

variables:
#MAVEN_HOME: “-s .m2/settings.xml --batch-mode”
MAVEN_OPTS: “-Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true”
MAVEN_CLI_OPTS: “–batch-mode verify sonar:sonar -Dsonar.host.url=****** -Dsonar.login=admin -Dsonar.gitlab.project_id=$env:CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$env:CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$env:CI_COMMIT_REF_NAME”

before_script:

  • $env:MAVEN_HOME=“D:\Maven\apache-maven-3.6.1”
  • env:PATH = "(env:PATH);($env:MAVEN_HOME)\bin;"

sonarqube_master_job:
stage: test
only:
- master
tags:
- windows

script:

  • “mvn $env:MAVEN_CLI_OPTS verify site site:stage”

sonarqube_preview_feature_job:
stage: test
only:
- /^feature/*/
script:
- git checkout origin/master
- git merge $env:CI_COMMIT_SHA --no-commit --no-ff
- ‘mvn --batch-mode verify sonar:sonar -Dsonar.host.url=http://********:9000/ -Dsonar.login=admin -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$env:CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$env:CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$env:CI_COMMIT_REF_NAME’

Is this issue resolved?, am facing the same issue. Could you help me to resolve if it is working for you