Build your Eclipse projects

Build your Java projects in the cloud with Ant or Maven and Visual Studio Online.

Connect to Visual Studio Online

  1. If you haven't already, install the Eclipse plug-in for Team Explorer Everywhere 2013 Update 1. (Show me how.)
  2. Show the team explorer views.

    Windows menu, show view, other

    You'll just use the team explorer here.

    Show View dialog box, Team Foundation Server expanded, Pending Changes and Team Explorer selected 
  3. In the team explorer view, connect to Visual Studio Online.

    Pending changes view, Connect to Team Foundation Server link 
  4. Configure the servers.

    Add Existing Team Project dialog box, Servers button 
  5. Add the server.

    Add/Remove Team Foundation Server dialog box, Add button

  6. Provide the URL to your Visual Studio Online account (http://[account] and sign in with your Microsoft account.

    Add Team Foundation Server dialog box with the server URL specified 
  7. Connect to the team project.

    Add Existing Team Project dialog box, with the collection and project selected 

Set up your build

  1. If you haven't already, upload the code that you're going to build. 
  2. From the team explorer in Eclipse, open the builds page.

      Builds in the team explorer home page 
  4. Create a build definition.

      New build definition link in the team explorer builds page
  6. Name the build definition.

      General tab in the build definition dialog box
  8. Set the trigger to define when builds are run.

      Trigger tab in the build definitoin dialog box with the continuous integration trigger selected 
  10. Set up the source of the build from a Team Foundation Git repository. Each time you push a commit to any of the selected branches, a build is started automatically because this is a CI build.

      Workspace tab in the build definition dialog box with the source selected from a Team Foundation Git repository 
  12. Choose the hosted build controller and copy the build output to the server.

      Build defaults tab in the build definition dialog box with the hosted build controller selected and copy the build output to the server set
  13. Create a build project file.

      Create button in the project file tab of the build definition dialog box 
  14. Create a build configuration based on your Ant or Maven build file.

      Create build configuration wizard, select a build configuration wizard page with Ant selected 
  15. Choose your Ant or Maven build file to use to build your Java project.

      Ant build file page of the Ant build coniguration wizard with the project build file selected 
  17. Save your build definition.

  18. Commit and push the changes required for the build to your Git repository.

    Choose Commit to save changes to Git repository

    Now you've created a new build definition for your Java project! Because you pushed a commit to the repository, a build has already been queued.

    Builds Tab of Team Explorer shows queued build 
  19. Since this is a CI build, a build is started every time you push a commit to one of the branches in your source settings tab.


Q:I want to use Ant to build my app in Visual Studio Online, but I'm not using it now. What do I need to do?

A:Set up a local Ant build, and then use the build file when you create your build definition in Visual Studio Online. The Ant manual will help you get started.

Q:Can I build my Java projects contained in a TFVC team project?

A:Yes. See how to do that here.

Q:When I try to create a build definition, I get an error that my workspace does not contain a Git repository with its upstream in the current team project. What should I do?

A:If you get this error, check if you have already imported a project into your Eclipse workspace from a Git team project on Visual Studio Online. If so, you need to configure branches to define the upstream for your Git repository. From the Git Repositories view, select a local branch for the repository and choose Configure Branch from the context menu. Select the values for Upstream Branch and Remote based on the repository that you cloned. Now create your build definition.

Q:What if my build fails?

A:Check here to see the requirements to use the hosted build controller to build your code.

Try this next

Manage your backlog in Visual Studio Online to get the most out of your account.