• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to run mvn commands using ms bat file

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am trying to run 2 mvn commands using ms bat file, but getting error.
I have create bat file in below mvn location

C:\apps\apache-maven-2.2.0\bin

this file contains:

call mvn clean
echo Exit Code = %ERRORLEVEL%
if not "%ERRORLEVEL%" == "0" exit /b

call mvn package
echo Exit Code = %ERRORLEVEL%
if not "%ERRORLEVEL%" == "0" exit /b

I am trying to run my bat file but getting error.



Can any one tell what is the wrong
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As the message says, when you run the mvn command (from within the .bat file) you should be in a folder which corresponds to a Maven project (i.e. there should be a pom.xml in that folder).
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jai,

I have moved my bat file to project location now it is working.
is it possible to run tomcat server after finishing mvn commands?

Thanks
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rather than moving the BAT file, you could have added the -f option to the mvn command and specified the location of the pom.xml file.

And yes, you can run Tomcat after running mvn, just add it to the bat file. (But that answer is much to simplistic, did you mean something else?)
 
reply
    Bookmark Topic Watch Topic
  • New Topic