Setting up an Ant or Maven build in TFS
Set up a continuous integration build with Eclipse and Team Foundation Server. When you check in code, the build runs automatically. That way, you can see and fix issues right away.
TFS can run Ant or Maven builds, but you'll need to set up your own build server. Once you've done that, TFS will handle Ant or Maven builds just like it handles other builds. TFS will trigger builds, handle the build drops, track the build results, and even create bugs when there's a build break.
Set up a TFS build server
Download and install Team Foundation Server Express 2012 on your build server.
After the installer finishes laying down the bits, the TFS Configuration Center opens automatically.
Start the Build Service Configuration wizard.
You can get to this wizard later by running the TFS administration console.
Connect to your team project collection in TFS.
This is where you provide the URL to your team project collection.
Create a new controller to run builds on this machine.
You can use a domain account to run the build service if you don't want to use NT AUTHORITY\NETWORK SERVICE.
If everything is correct, configure the build server.
Now you've set up your build server.
You'll see your build server in the list of build controllers in Eclipse, too.
Enable Ant or Maven builds on the build server
Now that you have a build server set up, make sure it can build your Ant or Maven projects.
Download and install a Java Development Kit.
Download and install Ant or Maven, depending on which build system you use. You can install both Ant and Maven on the same build machine if you use both build systems.
Download and install the TFS build extensions.
Set JAVA_HOME and ANT_HOME or M2_HOME environment variables according to the Java, Ant, or Maven installation instructions.
Define your CI build
Now you have a TFS build server that can build Ant and Maven projects. You're ready to define your CI build.
If you haven't already, connect to TFS and share your code.
Create a build definition from the Team Foundation Sever perspective in Eclipse.
Name and describe the build definition.
Use the trigger to indicate when to run the build. In this case, it will run whenever code is checked in.
Choose the project you want to build.
Select the build controller that you set up, and set the drop location.
Queue a build to make sure everything is working properly.
Now, when you check in code, a build will start automatically.