Using Team Foundation Server 2010 Build Service for Java Project using ANT

Posted by: Subodh Sohoni , on 11/22/2011, in Category VSTS & TFS (Azure DevOps)
Views: 120560
Abstract: In this article, we will explore how to use TFS 2010 for Build Management of Java Projects. We will use Eclipse based plug-in named Team Explorer Everywhere for creating a build definition that encapsulates an ant script and provides manageability to it.

In a previous article, I walked you through the process of using the various features related to Version Control of Team Foundation Server 2010. In this article now I will cover use of another service of TFS 2010 – Build Management for Java Projects. We will use Eclipse based plug-in named Team Explorer Everywhere for creating a build definition that encapsulates an ant script and provides manageability to it. Team Explorer Everywhere can be downloaded  over here.

Step 1: I assume that you have installed JDK, Eclipse and Apache Ant on your machine. If you have not configured environment variables, add the environment variable JAVA_HOME as JDK Path and add %JAVA_HOME%\bin; to the path. Also set the environment variable ANT_HOME to the ANT folder. In my case it was C:\Program Files\Java\Apache-Ant-1.8.1, so I added %ANT_HOME%\bin; to path.

Step 2: Install Microsoft Team Foundation Server 2010 Build Extensions that is downloadable from
http://visualstudiogallery.msdn.microsoft.com/2d7c8577-54b8-47ce-82a5-8649f579dcb6/ . It gives the ability to use Team Foundation Server 2010 Build service to do builds based upon Ant or Maven.

 



Step 3: To know how to create a Java Project in Eclipse and add it to TFS 2010 Version Control, you can go through my article -

To know how to create a Java Project in Eclipse and add it to TFS 2010 Version Control, you can go through my article - Using Team Foundation Server 2010 Version Control for a Java Project

Step 4: Let us now create build definition and queue build. To create an Ant script, add a new file to the Java project. Name it as build.xml

Step 5: Add the following code in this xml file

<project name="PwdValProject" default="compile">
   <target name="clean">

 

<delete dir="build"/>

    </target>
    <target name="compile" depends="clean">

<mkdir dir="build/classes"/>

<javac srcdir="." destdir="${DropLocation}\${BuildNumber}"/>

     </target>
</project>
 
Step 6: Checkin all the files

tfs-java-build-checkin

Step 7: Open the TeamFoundation Server Exploring perspective and expand the Tailspin Toys project. Select Builds node, right click on it and select New Build Definitions

tfs-new-build-definition
 
Step 8: Build Definition Creation wizard is started. In the first page of this wizard, enter the name of the build definition - Password Validator Build. You may optionally enter some description.

tfs-build-definition-validator

Step 9: Observe all the automation triggers on the trigger page. Keep the trigger to manual only but even if you select any automated trigger, it can be manually queued whenever required.

tfs-build-trigger

Step 10: Let the workspace to be used, be the default. On the Build Defaults page enter the drop location as \\MachineName\ShareName . If the shared folder does not already exists, then create and share it.

Step 11: On the Project File page of the wizard, browse to the Password Validator folder and then click the Create button

tfs-java-build5

Step 12: Select the option of MsBuild Configuration from existing Ant script and click Next

tfs-java-build6

Step 13: Drill down to the Build.xml file that you had checked in during the earlier step and Click Finish button

tfs-java-build7

Step 14: Let the retension policy be as it is

tfs-java-build8

Step 15: Click OK to complete the build configuration and close the wizard. You will find Password Validator Build definition appearing in the Builds folder of Team Explorer.

tfs-java-build9

Step 16: Right click on that build definition and select Queue New Build

tfs-java-build10

Click on the Queue button in the next page.

tfs-java-build11

You can view that the build is started and you will also be able to view the results once the build run is over.

This article has been editorially reviewed by Suprotim Agarwal.

Absolutely Awesome Book on C# and .NET

C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.

We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).

Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.

Click here to Explore the Table of Contents or Download Sample Chapters!

What Others Are Reading!
Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+

Author

Subodh is a Trainer and consultant on Azure DevOps and Scrum. He has an experience of over 33 years in team management, training, consulting, sales, production, software development and deployment. He is an engineer from Pune University and has done his post-graduation from IIT, Madras. He is a Microsoft Most Valuable Professional (MVP) - Developer Technologies (Azure DevOps), Microsoft Certified Trainer (MCT), Microsoft Certified Azure DevOps Engineer Expert, Professional Scrum Developer and Professional Scrum Master (II). He has conducted more than 300 corporate trainings on Microsoft technologies in India, USA, Malaysia, Australia, New Zealand, Singapore, UAE, Philippines and Sri Lanka. He has also completed over 50 consulting assignments - some of which included entire Azure DevOps implementation for the organizations.

He has authored more than 85 tutorials on Azure DevOps, Scrum, TFS and VS ALM which are published on www.dotnetcurry.com.Subodh is a regular speaker at Microsoft events including Partner Leadership Conclave.You can connect with him on LinkedIn .


Page copy protected against web site content infringement 	by Copyscape




Feedback - Leave us some adulation, criticism and everything in between!
Comment posted by Winston on Friday, July 18, 2014 8:39 AM
This kind of stuff creeps me out