Skip to content

Repository files navigation

Sonar logo

Sonar Scanning Examples

This repository contains practical examples for running SonarScanners and importing code coverage across multiple languages and build systems.

Examples

Various Languages

SonarScanner for various languages

Scan all the languages available or change directory to a language folder to scan just that language.

Ant

Scanning an Ant project is no different than scanning a plain Java (no build tool) project. Ant is used to build the project, but not to run the scan. Instead, the SonarScanner CLI is used.

SonarScanner for Ant is now deprecated. Please migrate to the SonarScanner CLI.

Gradle

If you have a Gradle project, we recommend the use of SonarScanner for Gradle or the equivalent gradle sonar task in your CI pipeline.

Maven

If you have a Maven project, we recommend the use of SonarScanner for Maven or the equivalent mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar goal in your CI pipeline.

DotNet/C#

If you have a .NET project, we recommend the use of SonarScanner for .NET or the equivalent SonarScanner for .NET on your CI pipeline.

Swift

SonarScanner - Swift Code Coverage

C/C++/Objective-C

NOTE: All SonarScanner examples for C, C++ and Objective-C can be found here.

  • SonarSource sample C and C++ projects with SonarQube Cloud or SonarQube Server analysis configured
  • C and C++ projects for different CI pipelines and build systems configured for Linux, Windows, and Mac

License

Copyright 2016-2026 SonarSource.

Licensed under the GNU Lesser General Public License, Version 3.0

About

Shows how to use the Scanners

Resources

Security policy

Stars

928 stars

Watchers

53 watching

Forks

Releases

Packages

Used by

Contributors

Languages