Reputation: 7234
I'm have a "bat" file with some maven commands which are pretty long so I tried to create a single file with MVN commands to execute. I call my bat file in cygwin as:
$./mvncommand.bat
Sample MVN commands in my file:
mvn install:install-file -DgroupId=org.openhealthtools.ihe -DartifactId=atna.auditor -Dversion=1.2.0 -Dfile=resources/lib/org.openhealthtools.ihe.atna.auditor_1.2.0.jar -Dpackaging=jar -DgeneratePom=false
mvn install:install-file -DgroupId=org.openhealthtools.ihe -DartifactId=atna.context -Dversion=1.2.0 -Dfile=resources/lib/org.openhealthtools.ihe.atna.context_1.2.0.jar -Dpackaging=jar -DgeneratePom=true
Strangely, only the first mvn install is executed and the all is ok. But how to make Cygwin call the rest of the mvn commands?
Thank you.
JR
Upvotes: 1
Views: 2031
Reputation: 354516
Maven (mvn
) is a batch file and running batch files from another batch file must be done with call
.
So change what you have into
call mvn ...
and it should work.
This has nothing to do with Cygwin, by the way.
Upvotes: 3
Reputation: 13289
It's possible that your first mvn command is returning an error code. In Windows's cmd, this will cause all subsequent commands to not run. This might be the behavior you want, but you should consider using a *nix-like shell rather than a Windows batch file since you're already using Cygwin.
For example, you could put both commands in a file named mvncommand
with your shell of choice.
#!/usr/bin/bash
mvn install:install-file -DgroupId=org.openhealthtools.ihe -DartifactId=atna.auditor -Dversion=1.2.0 -Dfile=resources/lib/org.openhealthtools.ihe.atna.auditor_1.2.0.jar -Dpackaging=jar -DgeneratePom=false
mvn install:install-file -DgroupId=org.openhealthtools.ihe -DartifactId=atna.context -Dversion=1.2.0 -Dfile=resources/lib/org.openhealthtools.ihe.atna.context_1.2.0.jar -Dpackaging=jar -DgeneratePom=true
Upvotes: 0