Check out our NEW end-to-end Java DevOps demo video on YouTube!

ON THIS PAGE we will highlight how you can perform SonarQube analysis during a Maven and/or Gradle build using Team Foundation Server 2015 Update 1 or Visual Studio Team Services.
ASSUMPTIONS

  • You have a Team Foundation team project available. If you don't, we encourage you to go through our Getting Started walkthrough.
  • If you aren't doing the tutorial, you need to have an existing Maven and/or Gradle build task to use.
  • You have a SonarQube server setup for use.

SonarQube

SonarQube is a set of static analyzers that can be used to identify areas of improvement in your code. It allows you to analyze the technical debt in your project and keep track of it in the future. With Maven and Gradle build tasks, you can run SonarQube analysis with minimal setup in a new or existing build task.

Creating a SonarQube Endpoint

To use your SonarQube server, you need to setup an endpoint connection under the Services tab in the Control Panel menu. For explicit instructions on how to configure your SonarQube endpoint, please follow the instructions outlined in our blog introducing the new build task.

Enabling SonarQube Analysis

After setting up a Maven/Gradle build task for your repository, you can enable SonarQube analysis by selecting the option under the Code Analysis option in the task. Both build tasks will require you to select a SonarQube endpoint which you should have already configured. Additional information such as project name, project key, etc. may be needed depending on the task.

SonarQube support for Maven is currently available on Team Services or Team Foundation Server 2015 Update 1 or later.

SonarQube support for Gradle is currently available for Team Services and Team Foundation Server 2017 or later.

Next Steps

For more detailed instructions on enabling SonarQube analysis please visit the following blog posts:

Frequently Asked Questions (FAQ)

Q: What versions of TFS support SonarQube analysis in builds?

A: At this moment, SonarQube analysis is available for both Maven abd Gradle build tasks on Team Services. Additionally, it is also present for the Maven build task in Team Foundation Server 2015 Update 1 or late.