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.

    Window menu, Show View, Other

    You'll just use the team explorer here.

    Show View dialog box,Team Foundation Server expanded, Team Explorer view 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].visualstudio.com) and sign in with your Microsoft account.

    Add Team Foundation Server dialog boc with the server URL specified

  7. Connect to the team project.

    Add Existing Team Project dialog box with collection and team 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

  3. Create a build definition.

    New Build Definition link in the team explorer builds page

  4. Name the build definition.

    General tab in the build definitions dialog box

  5. Set the trigger to define when builds are run.

    Trigger tab in the build definitions dialog box with Continuous Integration selected

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

    Source Settings tab in the build definitions dialog box with the source selected

  7. Choose the hosted build controller and copy the build output to the server.

    Build Defaults tab in the build definitions dialog box with the Hosted Build Controller selected

  8. Create a build project file.

    Project File tab in the build definitions dialog box

  9. Create a build configuration based on your Ant or Maven build file.

    Create Build Configuration Wizard, Select a Build Configuration page, Ant selected

  10. Choose your Ant or Maven build file to use to build your Java project.

    Create Build Configuration Wizard, Ant Build File page, build.xml selected

  11. Save your build definition.

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

    Choose commit to save changes to the 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 in the team explorer shows queued build

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&A

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.