I need to build 3 independent maven projects using a build.bat file (because of tycho aggregation is not an option - see comments on romaintaz answer). I have tried (executed from the build folder - see below):
cd ../projectA mvn clean install -U cd .. cd ../projectB mvn clean install -U cd .. cd ../projectC mvn clean install -U
where the folder structure of the projects are:
build |--> build.bat projectA |--> pom.xml projectB |--> pom.xml projectC |--> pom.xml
but only projectA is build projectB and projectC are skipped. Any ideas on how to modify the above batfile so the following project is build if the previous was build successfully?
Use these commands in batch file to run ur script. Keep your batch file where you pom. xml file is housed set ProjectPath=C:\TetonWorkSpace\PeriodicApplicationCheck cd %ProjectPath% mvn clean test -Dxmlfile=Smoke. xml pause To Create a Task in Task scheduler: 1.
bat file at the 'C:\apache-maven-3.3. 9\bin' location.
Use the call
command to execute your mvn processes, like:
call mvn clean install -U
See online doc for call or
help call
for further explanations on the call command.
To avoid having all these cd
commands you can also use the -f
option to specify the path to your pom, e.g.
call mvn -f <path>/projectA/pom.xml clean install -U call mvn -f <path>/projectB/pom.xml clean install -U call mvn -f <path>/projectC/pom.xml clean install -U
As noted above, you need to use "call" to run mvn script as in:
call mvn package
In order to catch errors you need to use the ERROR_LEVEL
variable as in:
call mvn clean echo Exit Code = %ERRORLEVEL% if not "%ERRORLEVEL%" == "0" exit /b
See http://jojovedder.blogspot.com/2009/03/executing-multiple-mvn-commands-from.html for further comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With