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

  1. Download and install Team Foundation Server Express 2012 on your build server.

  2. After the installer finishes laying down the bits, the TFS Configuration Center opens automatically.

    Team Foundation Server Configuration Center

  3. Start the Build Service Configuration wizard.

    Build Service Configuration Wizard


    You can get to this wizard later by running the TFS administration console.

  4. Connect to your team project collection in TFS.

    Select a Team Project CollectionConnect to Team Project CollectionAdd Team Foundation Server

    This is where you provide the URL to your team project collection.

    Add Team Foundation Server

  5. Create a new controller to run builds on this machine.

    Build Service Configuration Wizard

  6. You can use a domain account to run the build service if you don't want to use NT AUTHORITY\NETWORK SERVICE.

    Build Service Settings

  7. If everything is correct, configure the build server.

    Configure the build server

    Now you've set up your build server.

    Configuration progressBuild Configuration Progress

    You'll see your build server in the list of build controllers in Eclipse, too.

    Build Definition

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.

  1. Download and install a Java Development Kit.

  2. 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.

  3. Download and install the TFS build extensions.

  4. 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.

  1. If you haven't already, connect to TFS and share your code.

  2. Create a build definition from the Team Foundation Sever perspective in Eclipse.

    Team ExplorerNew Build Definition

  3. Name and describe the build definition.

    Name the build definition

  4. Use the trigger to indicate when to run the build. In this case, it will run whenever code is checked in.

    Build trigger

  5. Choose the project you want to build.

    Choose the projectBrowse for folder

  6. Select the build controller that you set up, and set the drop location.

    Build Definition

    Queue a build to make sure everything is working properly.

    Queue new build

    Now, when you check in code, a build will start automatically.

See Also


Team Foundation Server Plug-in for Eclipse - Beginner's Guide