Azure DevOps, Scrum, & .NET Software Leadership and Consulting Services

Free course! Predicting the Future, Estimating, and Running Your Projects with Flow Metrics

Fixing the empty drop problem with Visual Studio Online Java builds

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 name="compile" depends="init">
   <javac srcdir="src" destdir="build/classes" />
 <target name="compress" depends="compile">
   <jar destfile="${BinariesRoot}/HelloWorld.jar" basedir="build/classes">
       <attribute name="Main-Class"
 <target name="execute" depends="compile">
   <java classname="javasample1.HelloWorld" classpath="build/classes" />
 <target name="clean">
   <delete dir="build" />
   <delete dir="dist" />

The secret sauce that Will added was to modify my <jar /> element to fix the destfile attribute.  The value that I originally had (aka. the wrong value) was destfile=”dist/HelloWorld.jar”.  The correct version uses the “${BinariesRoot}” variable that resolves to the drop directory (see above).

Here’s a link to the complete sample code for my “Hello World” in Java in Eclipse.



One response to “Fixing the empty drop problem with Visual Studio Online Java builds”

  1. Carlos Avatar

    It really was very useful, I suppose that you have the same problem with the path for documentation and the testing results

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.