Issue
I am running an azure pipeline for a maven project which has windows commands for maven installation, by calling multiple methods i.e.,
class="snippet-code-js lang-js prettyprint-override">call mvn ... clean install
call mvn ... clean package (authentication)
call mvn ... clean package (restapi)
The build environment is linux Hence I am converting all the commands in the batch file to sh commands. For maven installation I initially added a maven installation task by mentioning the path and commands in the task. This failed. So I am currently changing the windows commands to sh commands. The other commands except for maven installation have been converted using a batch to sh commands reference article. Could some one guide me to convert the above mentioned installation commands to sh commands?
Solution
If the Apache Maven has been installed and added to the system path on the agent machine where your pipeline runs, you can just try directly calling the mvn
command in the bash script, like you call it on Windows.
For example:
mvn ... clean install
mvn ... clean package (authentication)
mvn ... clean package (restapi)
Before you execute the bash script in the pipeline, you firstly should try and debug it on your local machine to make sure it can work as expected on the local machine. Then move the bash script to the pipeline on Azure DevOps.
If the bash script runs failed in the pipeline, for us to investigate this issue further, please share us with the complete debug logs of the failed pipeline run. To get the debug logs, you need to set the pipeline variable System.Debug
to true
, then trigger the pipeline.
Answered By - Bright Ran-MSFT
Answer Checked By - Candace Johnson (JavaFixing Volunteer)