Usage of sonar-scanner

308 views
Skip to first unread message

vinay premkumar

unread,
Oct 16, 2017, 12:38:23 PM10/16/17
to SonarQube
Hi,

We are using SonarQube6.1 in our environment to run sonar analysis for Java,Javascript based projects. We follow the below methods for projects.

1) Use maven command with the option say "-Dsonar.analysis.mode=publish" and push the analysis data to the sonar server.
2) Use "sonar-scanner" to run analysis and push the data to the sonar server.

Option 1 has preview, publish modes,not sure if Option 2 has similar modes available. Can you please let me know the advantages/differences of using "sonar-scanner" ?

Regards,
Vinay

G. Ann Campbell

unread,
Oct 16, 2017, 12:51:13 PM10/16/17
to SonarQube
Hi Vinay,

First, you should know that mode=publish is redundant - this is the default. Second, this parameter is about to be deprecated. 

Second, both scanners accomplish the same thing, but one is native to Maven, and the other is not. You should use the Scanner that best suits your project. So if it's a Maven project, then use the SonarQube Scanner for Maven. If it's a C# project, use the SonarQube Scanner for MSBuild. And so on for Gradle, Ant, VSTS/TFS, and Jenkins. And if none of those is a good fit, then fall back to the vanilla SonarQube Scanner.


Ann

vinay premkumar

unread,
Oct 16, 2017, 1:39:51 PM10/16/17
to SonarQube
Hi Ann,

Thanks for the quick response. We intend to use sonar analysis at gate to catch issues earlier, with option 1 we can use analysis.mode as preview which doesn't push the data to the server.Does sonar-scanner also have a preview like option?

Regards,
Vinay

G. Ann Campbell

unread,
Oct 16, 2017, 2:10:53 PM10/16/17
to vinay premkumar, SonarQube
Hi Vinay,

Analysis parameters are not scanner-specific. What works for one will work for the others. But again, this is about to be deprecated.


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/ZsWTc-kbznA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/27782247-4506-40fa-9bbe-7044ce841b2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

bpar...@gmail.com

unread,
Oct 16, 2017, 3:36:58 PM10/16/17
to SonarQube
Hi Ann,
I work with Vinay. When you say that the preview option (-Dsonar.analysis.mode=preview) is going to be deprecated, do you mean we no longer can do analysis in preview mode? Do you mean that every run of sonar analysis WILL/MUST push the results to the sonar server? If so, what is the reason for deprecating it? 

Also, by "deprecated", do you mean the preview option is going away completely or just being replaced with another equivalent option?

Thanks
Balaji
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.

G. Ann Campbell

unread,
Oct 16, 2017, 4:23:43 PM10/16/17
to bpar...@gmail.com, SonarQube
Hi Balaji,

"Deprecated" means that it still works for now, but its use is not recommended and should be quickly phased out. And without it, yes, every analysis will update the server. 

Why? What will it be replaced with? Robust branch support( as a commercial feature).


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/3a4e5bfe-4739-4c5a-85a3-3bd8fd5a357a%40googlegroups.com.

bpar...@gmail.com

unread,
Oct 16, 2017, 5:34:49 PM10/16/17
to SonarQube
H Ann,
Can you provide more details on the robust branch support? Is there some place I can read about it?
Also, from which version onwards will the support for preview not work?

Thanks
Balaji

G. Ann Campbell

unread,
Oct 17, 2017, 7:32:16 AM10/17/17
to bpar...@gmail.com, SonarQube
Hi Balaji,

I don't have documentation yet for this feature.

It has not been decided yet when analysis mode will be removed. To be clear, it's not even deprecated yet. But I didn't feel comfortable tacitly endorsing your use of it knowing that it would be soon.


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/5f4b25f5-109c-4fab-82cd-c2846311de73%40googlegroups.com.

Christine Nof

unread,
Nov 6, 2017, 5:14:17 PM11/6/17
to SonarQube
Dear Ann,

Is there any way to vote against this being deprecated? We utilize this feature at our gate, as a way to block bad submissions from entering the code base. Adding a branch for each attempted submission doesn't seem like a good solution for what we need to do.

Thank you,
Christine

Christine Nof

unread,
Nov 7, 2017, 1:05:12 PM11/7/17
to SonarQube
Hi Ann,

Our company has been talking about this a great deal. Does this mean that there will not be a command-line way for developers to check their code for new issues? If I remember right, the command-line tool is going to be removed at some point. SonarLint only works on three IDEs, and now preview mode is going away.

Thank you,
Christine

G. Ann Campbell

unread,
Nov 15, 2017, 3:25:58 PM11/15/17
to Christine Nof, SonarQube
Hi Christine,

Believe it or not, I'm not actually ignoring you.

There should be a more coherent statement "soon".


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/48ab3570-36aa-422a-a8d3-9fe11d84fc1f%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages