开发者

How to get MSBuild Exec to run a java program?

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>&quot;C:\Program Files\Wavelink\A开发者_如何学运维valanche\PackageBuilder&quot;</PkgBldWorkingDir>

  <!--Command line to run to make Package builder "go"-->
  <PkgBldRun>.\jresdk\bin\java&quot; -classpath &quot;WLUtil.jar;WLPackageBuilder.jar&quot; 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).

Any ideas on how to make this run a command line action in MS Build?


So... here is the answer.

First my code had a error in it. I defined my working directory as PkgBldWorkingDir but used it as PackageBuilderWorkingDir. That was my first error.

The second one was putting quotes in my working dir property (PkgBldWorkingDir). The &quot; messes that up. Don't pass them in when setting up a working directory. It can handle spaces in a path with out the quotes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜