views:

90

answers:

2

We are using MSBuild to run our build which compiles and outputs a number of .NET projects/assemblies. Now we are faced with the need to also include a java version of on of our assemblies and are unsure how we should go about integrating the building of this java source into MSBuild.

There is always the option to shell out to a command prompt and have it perform the compilation and jar'ing manually, but are there any other and more elegant ways to go about consuming java building in MSBuild?

A: 

Creating your own msbuild task to compile java is possible (I have made one to compile VB6 code with MSBuild), but if it is a good idea is another question.. (YAGNI and all that)

If shelling out to the command line does work it may just be an OK thing to do.

My gut is saying shell out to an Ant process since Ant knows a little bit more about Java.

Arve
+2  A: 

The Exec task is the perfect thing. Easy, works. Not sure if that's what you mean by "Shell out".

Cheeso
'Shell out' was actually a call to the Exec task....only it would require us to do a lot of manual typing and keeping the java file references correct. Was looking for a way to take the human factor out...
soren.enemaerke
Instead of calling javac and jar directly, you can call ant and speficy the Java part in a build.xml which you keep as part of your code base.
rsp