• 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

.bat script with maven command

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I need help.
Sorry if I question incorporate the bad section.

I created .bat script for my application with maven commands.
code looks like this


Well, after the command mvn clean cmd is automatically terminated. If the command mvn clean miss, so cmd closes after the command mvn package. And next commands are executed. Why?
Thanks for answer

 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Miroslav,
When doing OS level scripting, you need to check the return code for whether a command succeeded for failed. On Windows, you use error level to do this. That lets you put in an if statement to prevent subsequent commands from being run.
 
Miroslav Benko
Greenhorn
Posts: 11
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solve it with this edited commands:

call mvn clean, call mvn package
 
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
The solution worked because "mvn" is not an executable, it is a batch file (mvn.bat). In Windows, if one batch file invokes another directly, when the invoked batch file finishes, script run ends. If you want the calling batch file to continue after the invoked batch file ends, you must use the "call" command.

In general, most Java "apps" are really batch files. And I have been bitten by this same issue more than I care to admit.
 
reply
    Bookmark Topic Watch Topic
  • New Topic