Reputation: 2566
I have below piece of code which will run the mvn goals through bash scripts in jenkins "Execute Shell".
bash -c $M2_HOME/bin/mvn -f $WORKSPACE/pom.xml compile -Dmaven.repo.local=$WORKSPACE/.repository --settings/var/lib/jenkins/.m2/settings-amazon.xml
Tried below format but no luck:
bash -c $M2_HOME/bin/mvn compile -f $WORKSPACE/pom.xml - Dmaven.repo.local=$WORKSPACE/.repository -- settings/var/lib/jenkins/.m2/settings-amazon.xm`l
Exception:
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. 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]
Upvotes: 0
Views: 323
Reputation: 58774
You probably don't have default goal, if you want to define it in pom.xml:
<build> <defaultGoal>clean install</defaultGoal> </build>
If not, add to mvn command the goal you want as :
mvn clean install -f
Upvotes: 1