How to get MSBuild Exec to run a java program?
- by Vaccano
I am trying to run a command line action in my Team Build (MSBuild).
When I run it on the command line of the build machine it works fine. But when run in the build script I get a "exited with code 3".
This is command that I am running:
C:\Program Files\Wavelink\Avalanche\PackageBuilder.\jresdk\bin\java -classpath
"WLUtil.jar;WLPackageBuilder.jar" com.wavelink.buildpkg.AvalanchePackageBuilder
/build PackageName
This command only works when run from the above directory (I have tried running it from c:\ with the full path at it fails).
When I try to run it using ms build this is my statement:
<PropertyGroup>
<!--Working directory of the Package Builder Call-->
<PkgBldWorkingDir>"C:\Program Files\Wavelink\Avalanche\PackageBuilder"</PkgBldWorkingDir>
<!--Command line to run to make Package builder "go"-->
<PkgBldRun>.\jresdk\bin\java" -classpath "WLUtil.jar;WLPackageBuilder.jar" com.wavelink.buildpkg.AvalanchePackageBuilder</PkgBldRun>
</PropertyGroup>
<!--Run package builder command line to update the Ava File.-->
<Exec ContinueOnError="true" WorkingDirectory="$(PackageBuilderWorkingDir)"
Command="$(PkgBldRun) /build PackageName"/>
As I said above this "exits with code 3". This is the full output:
Task "Exec"
Command:
.\jresdk\bin\java -classpath "WLUtil.jar;WLPackageBuilder.jar" com.wavelink.buildpkg.AvalanchePackageBuilder /build PackageName
The system cannot find the path specified.
MSBUILD : warning MSB3073: The command ".\jresdk\bin\java -classpath "WLUtil.jar;WLPackageBuilder.jar" com.wavelink.buildpkg.AvalanchePackageBuilder /build PackageName" exited with code 3.
The previous error was converted to a warning because the task was called with ContinueOnError=true.
Build continuing because "ContinueOnError" on the task "Exec" is set to "true".
Done executing task "Exec" -- FAILED.
It says it can't find the file (who knows what file).
I have tried it with and without the quotes (") in the working directory and with a full path as the command (gives the same error as when run on the command line).
Any ideas on how to make this run a command line action in MS Build?