Build your Java app with Maven

Last Update: 3/6/2017

Team Services | TFS 2017 | TFS 2015 | Previous versions: XAML Build, Release

After you've deployed an agent, you are ready to define a CI build that compiles your Java app with Maven whenever your team checks in code.

Upload your code

If you haven't already, upload your code to GIT or TFVC.

If you don't have any code, you can download our Hello world Java web app.

What code is in the sample app?

Create the definition

  1. Create the build definition.

    Build tab

    New Java build

  2. Specify the code you want to build and select the continuous integration (CI) trigger.

    CI trigger

  3. If your project builds with Maven, add the Maven build step. Otherwise add the build step your team uses.

    Add build step

    Add Maven build step

  4. Provide the path to your Maven POM file.

    Maven build step

  5. Select the continuous integration (CI) trigger and specify the code you want to build.

    CI trigger

  6. Save the definition.

    Save button

    Save the build

  7. Queue your new definition to make sure it works.

    Queue the build

    Completed build

Your team now has a CI build to validate every change checked into your codebase!


What code is in the sample app?

We used Eclipse to create our Hello World Java sample web app. We adapted a project created from the maven webapp archetype.

|-- .gitignore
`-- helloworld
    |-- .classpath
    |-- .project
    |-- pom.xml
    `-- src
        `-- main
            `-- webapp
                |-- WEB-INF
                |   `-- web.xml
                `-- index.jsp

The pom.xml file enables you to build with Maven. The .gitignore file keeps build artifacts on your dev machine from getting into your Git repo.

Can I deploy my app to Azure?

Deploy Java to Azure

What other kinds of apps can I build?

Build your app

What other kinds of build steps are available?

Specify your build steps

How do we protect our codebase from build breaks?

How do I modify other parts of my build definition?

I selected parallel multi-configuration, but only one build is running at a time.

If you're using Team Services, you might need more concurrent pipelines. See Concurrent build and release pipelines in Visual Studio Team Services.

How do I see what has changed in my build definition?

View the change history of your build definition

Do I need an agent?

You need at least one agent to run your build or release. Get an agent.

I can't select a default agent queue and I can't queue my build or release. How do I fix this?

See queues.

I use Team Foundation Server on-premises and I don't see some of these features. Why not?

Some of these features are available only on Visual Studio Team Services and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.