Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Other Build Tools
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Other Build Tools
how to run mvn commands using ms bat file
Reshma Reddy
Ranch Hand
Posts: 197
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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.
[INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [clean] [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one. [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: < 1 second [INFO] Finished at: Thu Sep 22 15:13:53 IST 2011 [INFO] Final Memory: 1M/63M [INFO] ------------------------------------------------------------------------
Can any one tell what is the wrong
Jaikiran Pai
Sheriff
Posts: 10445
227
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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).
[
My Blog
] [
JavaRanch Journal
]
Reshma Reddy
Ranch Hand
Posts: 197
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Peter Johnson
author
Posts: 5856
7
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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?)
JBoss In Action
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
maven subversion
maven java:compile
Need Help On A Maven WAR Build Issue
DOS batch file error handling?
Maven Build Failing (Cannot execute mojo:clean)
More...