I've locally installed maven on both Master and Slave and correctly set path for both JAVA_HOME and M2
jenkins@jenkins-slave-02:~$ echo $M2_HOME /opt/maven jenkins@jenkins-slave-02:~$ echo $JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-amd64 Once reach the stage involved mvn command, the error occurs /jenkins/workspace/simple_any_tests_master@tmp/durable-c32a56b1/script.sh: 1: mvn: not found I notice that this @tmp dir was empty which means no pom.xml and when looking closely by reproduce the mvn compile in @tmp dir [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.117 s [INFO] Finished at: 2021-03-24T12:09:50+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException I'm not sure what is the root cause of this error whereas incorrect maven path or slave setting (permission, etc.) Any helps would be appreciated Cheers -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAEaEQi%2BT7ggJQPR438rjgDG1BoWtWfhH_awu3mWZcXe82BTeGA%40mail.gmail.com.