Sonar Maven Plugin ignores properties

1,036 views
Skip to first unread message

CSchulz

unread,
May 3, 2016, 5:37:15 AM5/3/16
to SonarQube
Hello,

I have noticed that the recent sonar maven plugion (3.0.2) doesn't work like expected if you pass properties:

If you use -Dsonar.log.level=DEBUG it works.

-Dsonar.analysis.mode=preview has no effect:
[workspace] $ /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.9/bin/mvn -f jaxrs-versioning/pom.xml -gs /tmp/global-settings8836251098701737444.xml sonar:sonar -Dsonar.analysis.mode=preview -Dsonar.verbose=true -X -Dsonar.log.level=DEBUG 
...  
[DEBUG] Issues global mode  
...
[INFO] Load project repositories
[DEBUG] GET 200 http://localhost:9000/batch/project.protobuf?key=jaxrs%3Ajaxrs-versioning&issues_mode=true | time=16ms
[INFO] Load project repositories (done) | time=90ms
[INFO] Apply project exclusions
[DEBUG] Available languages:
[DEBUG]   * C# => "cs"
[DEBUG]   * Java => "java"
[DEBUG]   * JavaScript => "js"
[INFO] Load quality profiles
[DEBUG] GET 200 http://localhost:9000/api/qualityprofiles/search.protobuf?projectKey=jaxrs%3Ajaxrs-versioning | time=14ms
[INFO] Load quality profiles (done) | time=21ms
[INFO] Load active rules
[DEBUG] GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=cs-sonar-way-40535&p=1&ps=500 | time=54ms
[DEBUG] GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=java-sonar-way-43540&p=1&ps=500 | time=92ms
[DEBUG] GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=js-sonar-way-79462&p=1&ps=500 | time=41ms
[INFO] Load active rules (done) | time=240ms
[INFO] Issues mode
 
 
 

Julien HENRY

unread,
May 9, 2016, 8:51:13 AM5/9/16
to SonarQube
Hi,

-Dsonar.analysis.mode=preview works as expected. See log:
[INFO] Issues mode
(issues mode is the new name for old preview mode)

Regarding debug logs this is an expected behavior. We are now writing logs in the Maven logger (no more directly to System.out). It brings a lot of good side effects (better integration, support of log colorizer) but on the other side if you don't enable Maven DEBUG logs you won't see SQ DEBUG logs.

mvn sonar:sonar -Dsonar.verbose=true => SQ write DEBUG logs but Maven doesn't display them

mvn sonar:sonar -Dsonar.verbose=true -X => works fine
mvn sonar:sonar -X => works fine since we are automatically enabling SQ DEBUG logs when -X is used.

++

Julien

CSchulz

unread,
May 9, 2016, 8:57:23 AM5/9/16
to SonarQube
Hello,

Would it be possible to connect -Dsonar.verbose with -Dsonar.log.level=DEBUG?
So there would be no need for -X which could generate much output sometimes.

thanks for your fast reply. Is it possible to update http://docs.sonarqube.org/display/SONAR/Concepts page to have there the most recent informations?

Julien HENRY

unread,
May 9, 2016, 10:30:16 AM5/9/16
to SonarQube
Now we are "writing" in the standard Maven logger this is up to Maven logging implementation to decide what to display. By default Maven offer only -e or -X to configure log output but you can provide your own logging implementation or try to configure using:

In fact in my opinion we could even consider the opposite: deprecate/drop support of -Dsonar.verbose. I'm not aware of any other Maven plugin having its own property to configure log level.

++
Reply all
Reply to author
Forward
0 new messages