tags:

views:

57

answers:

2

Can someone tell me why after executing .bat script only first mvn deploy command is executed and then execution close. Why all command are not executed?

set GROUP_BASE=com.oracle.jdeveloper.jars
set VERSION=10.1.3.3.0.4157
set JDEV_HOME=C:/Oracle/jdevstudio10133
set REPO_URL=http://localhost:8081/nexus/content/repositories/thirdparty
set REPOSITORY_ID=thirdparty
mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.BC4J_lib -DartifactId=bc4jct -Dversion=%VERSION% -Dfile=%JDEV_HOME%/BC4J/lib/bc4jct.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.BC4J_lib -DartifactId=adfm -Dversion=%VERSION% -Dfile=%JDEV_HOME%/BC4J/lib/adfm.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.BC4J_jlib -DartifactId=bc4jui -Dversion=%VERSION% -Dfile=%JDEV_HOME%/BC4J/jlib/bc4jui.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.jlib -DartifactId=osdt_core -Dversion=%VERSION% -Dfile=%JDEV_HOME%/jlib/osdt_core.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.ord_jlib -DartifactId=ordim -Dversion=%VERSION% -Dfile=%JDEV_HOME%/ord/jlib/ordim.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.xdoclet-1_2_1 -DartifactId=xdoclet-ibm-module-1.2.1 -Dversion=%VERSION% -Dfile=%JDEV_HOME%/xdoclet-1.2.1/xdoclet-ibm-module-1.2.1.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.jlib -DartifactId=jssl-1_1 -Dversion=%VERSION% -Dfile=%JDEV_HOME%/jlib/jssl-1_1.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.jlib -DartifactId=javax-ssl-1_1 -Dversion=%VERSION% -Dfile=%JDEV_HOME%/jlib/javax-ssl-1_1.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
+2  A: 

Try with using the CALL command.

...
call mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.BC4J_lib -DartifactId=bc4jct -Dversion=%VERSION% -Dfile=%JDEV_HOME%/BC4J/lib/bc4jct.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
call mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.BC4J_lib -DartifactId=adfm -Dversion=%VERSION% -Dfile=%JDEV_HOME%/BC4J/lib/adfm.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
...

If you invoke a command without using CALL, control passes over to the new program and does not return (in your example this is what happens after the first mvn ...). CALL returns control to the caller and execution continues with the next instruction.

dpb
Same does `start "" "Command Here"` if I'm not mistaken.
Bobby
@Bobby: "start" opens up a new CMD window and I don't think you want a window for each command (especially if you have lots of them :D). I also think that "start" does not wait for the process to terminate, but I might be wrong about that.
dpb
@dpb: I've never noticed that that one would open a new cmd. :/ Also, I thought that was asked, that it runs 'asynchron'...
Bobby
I believe `CALL` is only relevant when calling another batch file.
aphoria
@aphoria CALL is valid for any executable (START calls ShellExecute and can open any registered type or url protocol, but the command will run in a new window etc)
Anders
@aphoria: Some tools actully use a batch file which can lead to unexpected things. `ant` is such a tool too.
Joey
@Anders You are correct. I guess I just haven't seen a reason to use `CALL` with an executable. Using `CALL` to call another batch file returns control to the original batch file when the secondary batch file is complete. What does using `CALL` with a .EXE do for you? I did some limited testing, but could not tell a difference.
aphoria
@Johannes I'm not sure what you are referring to.
aphoria
+1  A: 

Try this for each line you are running mvn:

START /WAIT "" mvn deploy:deploy-file -DgroupId=%GROUP_BASE%.BC4J_lib -DartifactId=bc4jct -Dversion=%VERSION% -Dfile=%JDEV_HOME%/BC4J/lib/bc4jct.jar -Dpackaging=jar -DrepositoryId=%REPOSITORY_ID% -Durl=%REPO_URL%
aphoria
Robs you of all output in a single window, though. You may want to add `/B` too.
Joey