# When to use sonar-scanner CLI versus SonarScanner plugin available with build tool’s like Maven,Gradle. etctera..?

**URL:** <https://community.sonarsource.com/t/when-to-use-sonar-scanner-cli-versus-sonarscanner-plugin-available-with-build-tool-s-like-maven-gradle-etctera/29464>\
**Category:** SonarQube Server / Community Build\
**Created:** [August 12, 2020, 3:29pm UTC](https://community.sonarsource.com/t/when-to-use-sonar-scanner-cli-versus-sonarscanner-plugin-available-with-build-tool-s-like-maven-gradle-etctera/29464 "2020-08-12T15:29:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yeshwanth](https://avatars.discourse-cdn.com/v4/letter/y/b5ac83/32.png) [@yeshwanth](https://community.sonarsource.com/u/yeshwanth)\
**Post date:** [August 12, 2020, 3:29pm UTC](https://community.sonarsource.com/t/when-to-use-sonar-scanner-cli-versus-sonarscanner-plugin-available-with-build-tool-s-like-maven-gradle-etctera/29464/1 "2020-08-12T15:29:23Z")

</div>

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):

- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Version: 8.3.1.34397 ( Community Edition)

- what are you trying to achieve  
Static code analysis Via Jenkins Pipeline

- what have you tried so far to achieve this

Hi,

I am new to sonarqube tool. Can someone please help me understand.

When to use sonar-scanner CLI versus SonarScanner plugin available with build tool’s like Maven,Gradle. etctera…?

Also, Will the final analysis report from both approaches will it be same?

Please help me understand.

Thanks in Advance

---

<div class="post-metadata">

**Author:** ![bcipollone](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/bcipollone/32/47031_2.png) [@bcipollone](https://community.sonarsource.com/u/bcipollone)\
**Post date:** [August 13, 2020, 4:22pm UTC](https://community.sonarsource.com/t/when-to-use-sonar-scanner-cli-versus-sonarscanner-plugin-available-with-build-tool-s-like-maven-gradle-etctera/29464/2 "2020-08-13T16:22:24Z")

</div>

Hi Yeshwanth,

Welcome to the SonarSource Community!

You should always use the Maven/Gradle/Ant scanner for Java analysis (assuming you are using one of those build technologies) as it makes configuration much easier and access to corresponding binaries and dependent libraries is required. Using the CLI scanner, you’ll need to configure a lot of parameters that are already known as part of the Maven/Gradle/Ant build.

Note that you must use the Scanner for MSBuild if you are analyzing .NET projects.

Brian

---

<div class="post-metadata">

**Author:** ![yeshwanth](https://avatars.discourse-cdn.com/v4/letter/y/b5ac83/32.png) [@yeshwanth](https://community.sonarsource.com/u/yeshwanth)\
**Post date:** [August 17, 2020, 4:53pm UTC](https://community.sonarsource.com/t/when-to-use-sonar-scanner-cli-versus-sonarscanner-plugin-available-with-build-tool-s-like-maven-gradle-etctera/29464/3 "2020-08-17T16:53:07Z")

</div>

Hi Brian,

The only reason I am leaning more towards CLI scanner is due to in our repositories we have multi-language code. If I use the SonarScanner for maven, that wouldn’t scan the other programming language files. Is that Correct?

Instead If I use the CLI Scanner that would scan the whole source code files once the repo is checked out during Jenkins Build job.

Do you have any other recommendation for our use case?

![repo](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/d/df4aae51f05eaaace83caf2fbc5c418d60f7851d.png)  
Thanks  
Yeshwanth

---

<div class="post-metadata">

**Author:** ![bcipollone](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/bcipollone/32/47031_2.png) [@bcipollone](https://community.sonarsource.com/u/bcipollone)\
**Post date:** [August 17, 2020, 6:06pm UTC](https://community.sonarsource.com/t/when-to-use-sonar-scanner-cli-versus-sonarscanner-plugin-available-with-build-tool-s-like-maven-gradle-etctera/29464/4 "2020-08-17T18:06:48Z")

</div>

Hi Yeshwanth,

As long as those files are in the source path, they will be picked up and scanned by the Maven scanner.

Brian
