A while back, Visual Studio Online (aka TFS in the cloud or TFS Azure or TFService) added the ability to do automated builds of Java code. That's a pretty handy feature when you're working in a cross-platform environment/company. We've been able to do this kind of thing "on prem" in Team Foundation Server for a while but being able to do this on Azure-based cloud build servers is new. It's a nice compliment to the cross-platform Team Explorer Everywhere features like the TFS plugin for Eclipse. So, if you're in the Java JDK, Ant, Maven, and Git world, Visual Studio Online (VSO) has got you covered.
The problem that I ran into was that I could make the code compile properly but when I went to access the output of the build (aka "the drop"), the zip file for the drop was empty. Thankfully, I got some help from Will Smythe at Microsoft.
The issue was with my build.xml file for the project.
<?xml version="1.0" ?>
<project name="HelloWorld" default="compress">
<target name="init">
<mkdir dir="build/classes" />
<mkdir dir="dist" />
</target>
<target name="compile" depends="init">
<javac srcdir="src" destdir="build/classes" />
</target>
<target name="compress" depends="compile">
<jar destfile="${BinariesRoot}/HelloWorld.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class"
value="javasample1.HelloWorld"/>
</manifest>
</jar>
</target>
<target name="execute" depends="compile">
<java classname="javasample1.HelloWorld" classpath="build/classes" />
</target>
<target name="clean">
<delete dir="build" />
<delete dir="dist" />
</target>
</project>
The secret sauce that Will added was to modify my
Here's a link to the complete sample code for my "Hello World" in Java in Eclipse.
-Ben