Reduce log level in Sonar 2.1.x - maven

I have a Maven 3.x build that uses Sonar 2.1.x for quality control. The maven-sonar plugin is used from inside Jenkins to run the Sonar checks.
During the Jenkins build, when Sonar kicks in, it logs A LOT of not so useful information at INFO level:
[INFO] [15:29:14.195] Java version: 1.6
[INFO] [15:29:20.853] Execute PMD 4.3 done: 6658 ms
[INFO] [15:29:20.853] Sensor PmdSensor done: 6658 ms
[INFO] [15:29:20.854] Sensor ProfileSensor...
[INFO] [15:29:21.186] Sensor ProfileSensor done: 332 ms
[INFO] [15:29:21.187] Sensor ProfileEventsSensor...
[INFO] [15:29:21.190] Sensor ProfileEventsSensor done: 3 ms
[INFO] [15:29:21.190] Sensor ProjectLinksSensor...
[INFO] [15:29:21.192] Sensor ProjectLinksSensor done: 2 ms
[INFO] [15:29:21.192] Sensor VersionEventsSensor...
[INFO] [15:29:21.198] Sensor VersionEventsSensor done: 6 ms
[INFO] [15:29:21.198] Sensor Maven dependencies...
[INFO] [15:29:21.261] Sensor Maven dependencies done: 63 ms
...
The log is quite big. I have been trying to find a way to set the log level to WARN with no luck. Any idea?
Thanks!

Unfortunately, there's no way to mute this INFO-level log.

As discussed here log level can be changed at the maven plugin level.
Run mvn with -Dorg.slf4j.simpleLogger.showLogName=true it will show the logger name with log like below
2022-11-09T05:47:18.8604059Z [INFO] org.sonarsource.scanner.maven.SonarQubeMojo - SCM writing changed lines (done) | time=83ms
2022-11-09T05:47:18.8604819Z [INFO] org.sonarsource.scanner.maven.SonarQubeMojo - Analysis report generated in 287ms, dir size=5.2 MB
2022-11-09T05:47:18.8605606Z [INFO] org.sonarsource.scanner.maven.SonarQubeMojo - Analysis report compressed in 1993ms, zip size=4.1 MB
2022-11-09T05:47:18.8606333Z [INFO] org.sonarsource.scanner.maven.SonarQubeMojo - Analysis report uploaded in 282ms
then on executing mvn with -Dorg.slf4j.simpleLogger.log.org.sonarsource.scanner.maven.SonarQubeMojo=error it will change the log level.

Related

Sonarqube analysis total time/duration [SonnarScanner for Maven]

I'm using Sonarqube 8.9 LTS with SonarScanner for Maven.
When we run any scan with SonarScanner for Maven, the normal output is:
[INFO] CPD Executor CPD calculation finished (done) | time=3287ms
[INFO] Analysis report generated in 2397ms, dir size=64 MB
[INFO] Analysis report compressed in 25206ms, zip size=24 MB
[INFO] Analysis report uploaded in 1866ms
[INFO] ANALYSIS SUCCESSFUL, you can browse http://127.0.0.1:9000/dashboard?id=project_id
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at http://127.0.0.1:9000/api/ce/task?id=task_id
[INFO] Analysis total time: 18:30.103 s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19:37 min
[INFO] Finished at: 2021-10-22T02:23:22Z
[INFO] ------------------------------------------------------------------------
Where do i find this information after the scan is completed?
I can't find it in the web ui or the rest api.
This information is not stored on the server.
I did ask the same question on sonar community and got the following response:
You won’t find this stored on the server; it’s not sent to the server
and is only available where you see it: in the client-side analysis
logs.
If you are
Global Administrators can view the status of Background task at Administration > Projects > Background Tasks.
Project administrators can see the tasks for a project at Project Settings > Background Tasks
More details in here Background Tasks

Sonar Maven HTTP error: 401

Need some help. Currently writing custom rules for my company. But during testing I encountered a problem. When I start local sonar and try to run project on it to test new rules, I get BUILD FAILURE. This is what I see when running project:
C:\Users\tgriusys\eclipse-workspace\simpleProject>mvn sonar:sonar
14:37:12:900 [INFO] Scanning for projects...
14:37:13:353 [INFO]
14:37:13:353 [INFO] ------------------------------------------------------------------------
14:37:13:353 [INFO] Building simpleProject 0.0.1-SNAPSHOT
14:37:13:353 [INFO] ------------------------------------------------------------------------
14:37:13:451 [INFO]
14:37:13:451 [INFO] --- sonar-maven-plugin:3.4.0.905:sonar (default-cli) # simpleProject ---
14:37:13:815 [INFO] User cache: C:\Users\tgriusys\.sonar\cache
14:37:13:897 [INFO] SonarQube version: 6.7.1
14:37:13:916 [INFO] Default locale: "en_US", source code encoding: "windows- 1257" (analysis is platform dependent)
14:37:14:178 [INFO] Publish mode
14:37:14:317 [INFO] Load global settings
14:37:14:388 [INFO] Load global settings (done) | time=72ms
14:37:14:396 [INFO] Server id: AWDU5v5flIPWulLSdQv7
14:37:14:405 [INFO] User cache: C:\Users\tgriusys\.sonar\cache
14:37:14:682 [INFO] Load plugins index
14:37:14:736 [INFO] Load plugins index (done) | time=54ms
14:37:15:313 [INFO] Process project properties
14:37:15:383 [INFO] Load project repositories
14:37:15:917 [INFO] Load project repositories (done) | time=534ms
14:37:16:027 [INFO] Load quality profiles
14:37:16:267 [INFO] Load quality profiles (done) | time=240ms
14:37:16:287 [INFO] Load active rules
14:37:16:498 [INFO] Load active rules (done) | time=211ms
14:37:16:502 [INFO] Load metrics repository
14:37:16:526 [INFO] Load metrics repository (done) | time=25ms
14:37:16:539 [INFO] Project key: simpleProject:simpleProject
14:37:16:540 [INFO] ------------- Scan simpleProject
14:37:16:641 [INFO] Base dir: C:\Users\tgriusys\eclipse-workspace\simpleProject
14:37:16:641 [INFO] Working dir: C:\Users\tgriusys\eclipse-workspace\simpleProject\target\sonar
14:37:16:644 [INFO] Source paths: pom.xml, src/main/java
14:37:16:644 [INFO] Test paths: src/test/java
14:37:16:645 [INFO] Source encoding: windows-1257, default locale: en_US
14:37:16:679 [INFO] Load server rules
14:37:16:798 [INFO] Load server rules (done) | time=119ms
14:37:16:905 [INFO] Index files
14:37:16:922 [INFO] 7 files indexed
14:37:16:923 [INFO] Quality profile for java: Exigen Coverage
14:37:16:924 [INFO] Quality profile for xml: Sonar way
14:37:17:054 [INFO] Sensor JavaSquidSensor [java]
14:37:17:189 [INFO] Configured Java source version (sonar.java.source): 5
14:37:17:222 [INFO] JavaClasspath initialization
14:37:17:238 [INFO] JavaClasspath initialization (done) | time=16ms
14:37:17:239 [INFO] JavaTestClasspath initialization
14:37:17:242 [INFO] JavaTestClasspath initialization (done) | time=3ms
14:37:17:508 [INFO] Java Main Files AST scan
14:37:17:509 [INFO] 6 source files to be analyzed
14:37:17:948 [INFO] Java Main Files AST scan (done) | time=439ms
14:37:17:948 [INFO] 6/6 source files have been analyzed
14:37:17:948 [INFO] Java Test Files AST scan
14:37:17:949 [INFO] 0 source files to be analyzed
14:37:17:950 [INFO] Java Test Files AST scan (done) | time=2ms
14:37:17:950 [INFO] 0/0 source files have been analyzed
14:37:17:951 [INFO] Sensor JavaSquidSensor [java] (done) | time=897ms
14:37:17:952 [INFO] Sensor FindBugs Sensor [findbugs]
14:37:19:188 [INFO] Loading findbugs plugin: C:\Users\tgriusys\eclipse-workspace\simpleProject\target\sonar\findbugs\findsecbugs-plugin.jar
14:37:19:207 [INFO] Findbugs output report: C:\Users\tgriusys\eclipse-workspace\simpleProject\target\sonar\findbugs-result.xml
14:37:20:931 [INFO] Sensor FindBugs Sensor [findbugs] (done) | time=2979ms
14:37:20:932 [INFO] Sensor SurefireSensor [java]
14:37:20:933 [INFO] parsing [C:\Users\tgriusys\eclipse-workspace\simpleProject\target\surefire-reports]
14:37:20:935 [INFO] Sensor SurefireSensor [java] (done) | time=3ms
14:37:20:935 [INFO] Sensor JaCoCoSensor [java]
14:37:20:938 [INFO] Sensor JaCoCoSensor [java] (done) | time=3ms
14:37:20:938 [INFO] Sensor SonarJavaXmlFileSensor [java]
14:37:20:950 [INFO] 1 source files to be analyzed
14:37:21:577 [INFO] Sensor SonarJavaXmlFileSensor [java] (done) | time=639ms
14:37:21:578 [INFO] 1/1 source files have been analyzed
14:37:21:578 [INFO] Sensor XML Sensor [xml]
14:37:21:719 [INFO] Sensor XML Sensor [xml] (done) | time=141ms
14:37:21:719 [INFO] Sensor Zero Coverage Sensor
14:37:21:737 [INFO] Sensor Zero Coverage Sensor (done) | time=18ms
14:37:21:738 [INFO] Sensor CPD Block Indexer
14:37:21:757 [INFO] Sensor CPD Block Indexer (done) | time=19ms
14:37:21:758 [INFO] SCM Publisher is disabled
14:37:21:759 [INFO] 6 files had no CPD blocks
14:37:21:759 [INFO] Calculating CPD for 0 files
14:37:21:760 [INFO] CPD calculation finished
14:37:21:889 [INFO] Analysis report generated in 112ms, dir size=19 KB
14:37:21:931 [INFO] Analysis reports compressed in 41ms, zip size=15 KB
14:37:21:956 [INFO] Analysis report uploaded in 24ms
14:37:21:957 [INFO] ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/simpleProject:simpleProject
14:37:21:958 [INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
14:37:21:959 [INFO] More about the report processing at http://localhost:9000/api/ce/task?id=AWOCfVUd_KYAMsLyvlL2
14:37:21:962 [INFO] Executing post-job org.sonar.report.pdf.batch.PDFPostJob
14:37:21:963 [INFO] Executing decorator: PDF Report
14:37:21:972 [INFO] Team workbook report type selected
14:37:22:058 [INFO] Retrieving project info for simpleProject:simpleProject
14:37:22:234 [INFO] ------------------------------------------------------------------------
14:37:22:234 [INFO] BUILD FAILURE
14:37:22:235 [INFO] ------------------------------------------------------------------------
14:37:22:236 [INFO] Total time: 9.616 s
14:37:22:237 [INFO] Finished at: 2018-05-21T14:37:22+03:00
14:37:22:369 [INFO] Final Memory: 27M/981M
14:37:22:369 [INFO] ------------------------------------------------------------------------
14:37:22:373 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project simpleProject: HTTP error: 401, msg: , query: org.apache.commons.httpclient.methods.GetMethod#5d957cf0 -> [Help 1]
14:37:22:374 [ERROR]
14:37:22:375 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
14:37:22:375 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
14:37:22:376 [ERROR]
14:37:22:376 [ERROR] For more information about the errors and possible solutions, please read the following articles:
14:37:22:377 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
After this I can check analysis and check if rules are working properly but I wonder why build fails and what can I do to solve it?
In my situation,it`s the pdf report plugin that caused the BUILD FAILURE error.
After the plugin is removed in the sonarqube web and server dir ,then the analysis goes well.
Here is the part of error message:
An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar: java.lang.NoSuchMethodError: org.sonar.api.batch.postjob.PostJobContext.settings()Lorg/sonar/api/config/Settings;

Analyse TypeScript SonarQube in Maven project

I'll try to use the SonarQube SonarTS plugin to analyse TypeScript files in a project of mine.
It contains a submodule that contains some images, some xmls, and a couple of .ts-files. I have installed SonarTS ( https://docs.sonarqube.org/display/PLUG/SonarTS ) in SonarQube. The project uses typescript 2.4.2 as a devDependency and is build with Node 6.13.1.
When I call mvn sonar:sonar -Dsonar.branch=<BRANCHNAME> (I know sonar.branch is deprecated, I'll fix soon :)), eventually the sum-module is scanned and this is the log:
[INFO] ------------- Scan MyProject
[INFO] Base dir: /home/jenkins/workspace/my-project/my-project-config-model
[INFO] Working dir: /home/jenkins/workspace/my-project/my-project-config-model/target/sonar
[INFO] Source paths: pom.xml
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] 1 file indexed
[INFO] Quality profile for xml: Sonar way
[INFO] Sensor Embedded CSS Analyzer Sensor [css]
[INFO] 0 source files to be analyzed
[INFO] Sensor Embedded CSS Analyzer Sensor [css] (done) | time=1ms
[INFO] Sensor SonarJavaXmlFileSensor [java]
[INFO] 0/0 source files have been analyzed
[INFO] 1 source files to be analyzed
[INFO] Sensor SonarJavaXmlFileSensor [java] (done) | time=31ms
[INFO] 1/1 source files have been analyzed
[INFO] Sensor XML Sensor [xml]
[INFO] Sensor XML Sensor [xml] (done) | time=8ms
[INFO] SCM provider for this project is: git
[INFO] 1 files to be analyzed
[INFO] 0/1 files analyzed
And the only file that is scanned is the pom.xml
Could it have something to do with the structure of the sub-module? The xmls and ts files are not at src/main/{ts|resources}, but src/models and src/scripts.
Thanks in advance!
I guess you need to change the sonar.sources parameter to include your source folders (something like sonar.sources=src/main/java,src/models,src/scripts should work).
You can find more about analysis parameters here, and more about the way to configure the maven scanner here.

SonarQube doesn't generate "duplications" information

I've managed to install SonarQube 5.1 using the official docker image from SonarSource.
I am actually running sonar using the default H2 DB and I have got almost eveything woking for my demo Java project: Coverage, unit tests and issues.
However, the duplications are 0%. I have created a test classes with the following code:
public class Test {
public Test() {
for(int i = 0; i < 10; i++)
{
System.out.println("Test");
System.out.println("Test");
System.out.println("Test");
}
for(int i = 0; i < 10; i++)
{
System.out.println("Test");
System.out.println("Test");
System.out.println("Test");
}
}
How can be the duplications 0%? I think something is not working in my set...
In addition, Sonar has detected some major issues in my class, but nothing related with the duplications:
Hide this public constructor
Replace this usage of System.out or System.err by a logger
In order to generate the sonar report, I am executing sonar:sonar using maven. That's the output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building demoservice 0.1.0.-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:2.6:sonar (default-cli) # demoservice ---
[INFO] SonarQube version: 5.1
INFO: Default locale: "en_GB", source code encoding: "UTF-8"
INFO: Work directory: W:\DemoService\target\sonar
INFO: SonarQube Server 5.1
[INFO] [15:52:47.080] Load global repositories
[INFO] [15:52:47.290] Load global repositories (done) | time=212ms
[INFO] [15:52:47.293] Server id: 20150917085707
[INFO] [15:52:47.295] User cache: C:\Users\jose.valencia\.sonar\cache
[INFO] [15:52:47.303] Install plugins
[INFO] [15:52:47.402] Install JDBC driver
[INFO] [15:52:47.412] Create JDBC datasource for jdbc:h2:tcp://localhost:9092/sonar
[INFO] [15:52:48.524] Initializing Hibernate
[INFO] [15:52:50.183] Load project repositories
[INFO] [15:52:51.840] Load project repositories (done) | time=1657ms
[INFO] [15:52:51.841] Load project settings
[INFO] [15:52:52.252] Load technical debt model
[INFO] [15:52:52.285] Apply project exclusions
[INFO] [15:52:53.136] ------------- Scan demoservice
[INFO] [15:52:53.139] Load module settings
[INFO] [15:52:53.238] Language is forced to java
[INFO] [15:52:53.244] Load rules
[INFO] [15:52:53.437] Base dir: W:\DemoService
[INFO] [15:52:53.437] Working dir: W:\DemoService\target\sonar
[INFO] [15:52:53.438] Source paths: pom.xml, src/main/java
[INFO] [15:52:53.438] Test paths: src/test/java
[INFO] [15:52:53.439] Binary dirs: target/classes
[INFO] [15:52:53.439] Source encoding: UTF-8, default locale: en_GB
[INFO] [15:52:53.439] Index files
[INFO] [15:52:53.456] 9 files indexed
[INFO] [15:52:53.642] Quality profile for java: Sonar way
[INFO] [15:52:53.672] Sensor JavaSquidSensor
[INFO] [15:52:55.794] Java Main Files AST scan...
[INFO] [15:52:55.796] 6 source files to be analyzed
[INFO] [15:52:57.434] Java Main Files AST scan done: 1640 ms
[INFO] [15:52:57.435] 6/6 source files have been analyzed
[INFO] [15:52:57.437] Java bytecode scan...
[INFO] [15:52:57.551] Java bytecode scan done: 114 ms
[INFO] [15:52:57.551] Java Test Files AST scan...
[INFO] [15:52:57.552] 3 source files to be analyzed
[INFO] [15:52:58.106] Java Test Files AST scan done: 555 ms
[INFO] [15:52:58.107] 3/3 source files have been analyzed
[INFO] [15:52:58.111] Package design analysis...
[INFO] [15:52:58.164] Package design analysis done: 53 ms
[INFO] [15:52:58.193] Sensor JavaSquidSensor (done) | time=4521ms
[INFO] [15:52:58.193] Sensor Lines Sensor
[INFO] [15:52:58.196] Sensor Lines Sensor (done) | time=3ms
[INFO] [15:52:58.196] Sensor QProfileSensor
[INFO] [15:52:58.201] Sensor QProfileSensor (done) | time=5ms
[INFO] [15:52:58.201] Sensor InitialOpenIssuesSensor
[INFO] [15:52:58.270] Sensor InitialOpenIssuesSensor (done) | time=69ms
[INFO] [15:52:58.270] Sensor ProjectLinksSensor
[INFO] [15:52:58.286] Sensor ProjectLinksSensor (done) | time=16ms
[INFO] [15:52:58.286] Sensor VersionEventsSensor
[INFO] [15:52:58.309] Sensor VersionEventsSensor (done) | time=23ms
[INFO] [15:52:58.309] Sensor Maven dependencies
[INFO] [15:53:01.186] Sensor Maven dependencies (done) | time=2877ms
[INFO] [15:53:01.186] Sensor CoberturaSensor
[INFO] [15:53:01.186] parsing W:\DemoService\target\site\cobertura\coverage.xml
[INFO] [15:53:01.283] Sensor CoberturaSensor (done) | time=97ms
[INFO] [15:53:01.283] Sensor SurefireSensor
[INFO] [15:53:01.284] parsing W:\DemoService\target\surefire-reports
[INFO] [15:53:01.302] Sensor SurefireSensor (done) | time=19ms
[INFO] [15:53:01.302] Sensor SCM Sensor
[INFO] [15:53:01.309] SCM provider for this project is: git
[INFO] [15:53:01.313] 1 files to be analyzed
[INFO] [15:53:01.548] 1/1 files analyzed
[INFO] [15:53:01.549] Sensor SCM Sensor (done) | time=247ms
[INFO] [15:53:01.549] Sensor CPD Sensor
[INFO] [15:53:01.549] JavaCpdEngine is used for java
[INFO] [15:53:01.549] Cross-project analysis disabled
[INFO] [15:53:01.595] Sensor CPD Sensor (done) | time=46ms
[INFO] [15:53:01.596] No quality gate is configured.
[INFO] [15:53:01.642] Compare to previous analysis (2015-09-17)
[INFO] [15:53:01.651] Compare over 30 days (2015-08-18, analysis of Wed Sep 16 17:23:06 BST 2015)
[INFO] [15:53:01.944] Execute decorators...
[INFO] [15:53:02.987] Store results in database
[INFO] [15:53:04.851] Analysis reports generated in 75ms, dir size=8 KB
[INFO] [15:53:04.879] Analysis reports compressed in 28ms, zip size=8 KB
[INFO] [15:53:04.914] Analysis reports sent to server in 35ms
[INFO] [15:53:04.915] ANALYSIS SUCCESSFUL, you can browse http://10.1.2.77:9001/dashboard/index/pbs.demoservice:demoservice
[INFO] [15:53:04.915] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.371s
[INFO] Finished at: Thu Sep 17 15:53:05 BST 2015
[INFO] Final Memory: 37M/896M
[INFO] ------------------------------------------------------------------------
I am not sure if I have missed something or something is not configured properly. Any ideas?
Thanks!
I have found the problem. For Java projects, the duplication detection mechanism behaves slightly differently as a piece of code is considered as duplicated as soon as there is the same sequence of 10 successive statements whatever is the number of tokens and lines. Therefore, I have managed to see the duplications after adding more duplicated loops in my Test class.

mvn sonar:sonar not generating dashboard data

We use maven for building our projects.
I implemented the configuration mentioned in http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+Maven to analyze the project using sonar.
Snapshot of my .m2/settings.xml
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.jdbc.url>jdbc:oracle:thin:#10.207.67.95/XE</sonar.jdbc.url>
<sonar.jdbc.username>sonarqube</sonar.jdbc.username>
<sonar.jdbc.password>sonarqube</sonar.jdbc.password>
<sonar.jdbc.driver>oracle.jdbc.OracleDriver</sonar.jdbc.driver>
<sonar.host.url>http://localhost:9000</sonar.host.url>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
<activeProfile>sonar</activeProfile>
</activeProfiles>
When i run mvn sonar:sonar from the directory containing my pom.xml, it shows build success.
I checked the dashboard, the project shows up, and the LOC shown is empty.
Dashboard shows up no issues.
Output from mvn sonar:sonar
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxx 2.2.0.29-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:2.0:sonar (default-cli) # xxxx ---
[INFO] Sonar version: 3.6.2
[INFO] [15:18:16.984] Load batch settings
[INFO] [15:18:17.043] User cache: /home/jsaluja/.sonar/cache
[INFO] [15:18:17.048] Install plugins
[INFO] [15:18:17.589] Install JDBC driver
[INFO] [15:18:17.596] Create JDBC datasource for jdbc:oracle:thin:#10.207.67.95/XE
[INFO] [15:18:19.296] Initializing Hibernate
[INFO] [15:18:21.830] Load project settings
[INFO] [15:18:21.858] Apply project exclusions
[INFO] [15:18:22.003] ------------- Scan xxxx
[INFO] [15:18:22.008] Load module settings
[INFO] [15:18:22.607] Quality profile : [name=Sonar way,language=java]
[INFO] [15:18:22.625] Excluded tests:
[INFO] [15:18:22.625] **/package-info.java
[INFO] [15:18:22.660] Configure Maven plugins
[INFO] [15:18:22.728] Compare to previous analysis (2013-08-08)
[INFO] [15:18:22.750] Compare over 5 days (2013-08-03, analysis of 2013-08-07 12:55:06.0)
[INFO] [15:18:22.763] Compare over 30 days (2013-07-09, analysis of 2013-08-07 12:55:06.0)
[INFO] [15:18:22.890] Base dir: /home/jsaluja/0801/frontend/yyyy/xxxx
[INFO] [15:18:22.890] Working dir: /home/jsaluja/0801/frontend/yyyy/xxxx/target/sonar
[INFO] [15:18:22.890] Binary dirs: /home/jsaluja/0801/frontend/yyyy/xxxx/target/classes
[INFO] [15:18:22.890] Source encoding: UTF-8, default locale: en_US
[INFO] [15:18:22.894] Sensor JavaSourceImporter...
[INFO] [15:18:22.894] Sensor JavaSourceImporter done: 0 ms
[INFO] [15:18:22.894] Sensor JavaSquidSensor...
[INFO] [15:18:22.894] Sensor JavaSquidSensor done: 0 ms
[INFO] [15:18:22.894] Sensor SurefireSensor...
[INFO] [15:18:22.895] parsing /home/jsaluja/0801/frontend/yyyy/xxxx/target/surefire-reports
[INFO] [15:18:22.898] Sensor SurefireSensor done: 4 ms
[INFO] [15:18:22.898] Sensor CpdSensor...
[INFO] [15:18:22.898] SonarEngine is used
[INFO] [15:18:22.898] Sensor CpdSensor done: 0 ms
[INFO] [15:18:22.898] Sensor InitialOpenIssuesSensor...
[INFO] [15:18:22.901] Sensor InitialOpenIssuesSensor done: 3 ms
[INFO] [15:18:22.901] Sensor ProfileSensor...
[INFO] [15:18:23.209] Sensor ProfileSensor done: 308 ms
[INFO] [15:18:23.209] Sensor ProfileEventsSensor...
[INFO] [15:18:23.236] Sensor ProfileEventsSensor done: 27 ms
[INFO] [15:18:23.236] Sensor ProjectLinksSensor...
[INFO] [15:18:23.241] Sensor ProjectLinksSensor done: 5 ms
[INFO] [15:18:23.241] Sensor VersionEventsSensor...
[INFO] [15:18:23.253] Sensor VersionEventsSensor done: 12 ms
[INFO] [15:18:23.253] Sensor Maven dependencies...
[INFO] [15:18:23.805] Sensor Maven dependencies done: 552 ms
[INFO] [15:18:23.805] Sensor JaCoCoSensor...
[INFO] [15:18:23.809] Project coverage is set to 0% since there is no directories with classes.
[INFO] [15:18:23.809] Sensor JaCoCoSensor done: 4 ms
[INFO] [15:18:24.112] Execute decorators...
[INFO] [15:18:24.287] Store results in database
[INFO] [15:18:24.336] ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/a.b.c.d.e:xxxx
[INFO] [15:18:24.337] Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
[INFO] [15:18:24.337] Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
[INFO] [15:18:24.387] Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
[INFO] [15:18:24.398] -> Keep one snapshot per day between 2013-07-11 and 2013-08-07
[INFO] [15:18:24.400] -> Keep one snapshot per week between 2012-08-09 and 2013-07-11
[INFO] [15:18:24.401] -> Keep one snapshot per month between 2008-08-14 and 2012-08-09
[INFO] [15:18:24.402] -> Delete data prior to: 2008-08-14
[INFO] [15:18:24.404] -> Clean xxxx [id=10080]
[INFO] [15:18:24.409] <- Clean snapshot 13758
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.637s
[INFO] Finished at: Thu Aug 08 15:18:24 EDT 2013
[INFO] Final Memory: 19M/277M
I could independently run sonar runner from the same directory using sonar-project.properties and dashboard shows up data, and a bunch of issues.
Output from sonar runner:
~/sonar-runner-2.3/bin/sonar-runner
SonarQube Runner 2.3
Java 1.6.0_21 Sun Microsystems Inc. (64-bit)
Linux 2.6.18-238.5.1.el5 amd64
INFO: Runner configuration file: /home/jsaluja/sonar-runner-2.3/conf/sonar-runner.properties
INFO: Project configuration file: /home/jsaluja/0801/frontend/yyyy/xxxx/sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /home/jsaluja/0801/frontend/yyyy/xxxx/.sonar
INFO: SonarQube Server 3.6.2
15:19:14.377 INFO - Load batch settings
15:19:14.440 INFO - User cache: /home/jsaluja/.sonar/cache
15:19:14.444 INFO - Install plugins
15:19:14.944 INFO - Install JDBC driver
15:19:14.952 INFO - Create JDBC datasource for jdbc:oracle:thin:#10.207.67.95/XE
15:19:16.300 INFO - Initializing Hibernate
15:19:18.517 INFO - Load project settings
15:19:18.548 INFO - Apply project exclusions
15:19:18.682 INFO - ------------- Scan xxxx
15:19:18.688 INFO - Load module settings
15:19:19.295 INFO - Quality profile : [name=Sonar way,language=java]
15:19:19.314 INFO - Excluded tests:
15:19:19.314 INFO - **/package-info.java
15:19:19.355 INFO - Configure Maven plugins
15:19:19.439 INFO - Compare to previous analysis (2013-08-08)
15:19:19.463 INFO - Compare over 5 days (2013-08-03, analysis of 2013-08-08 14:38:22.472)
15:19:19.478 INFO - Compare over 30 days (2013-07-09, analysis of 2013-08-08 14:38:22.472)
15:19:19.647 INFO - Base dir: /home/jsaluja/0801/frontend/yyyy/xxxx
15:19:19.647 INFO - Working dir: /home/jsaluja/0801/frontend/yyyy/xxxx/.sonar
15:19:19.648 INFO - Source dirs: /home/jsaluja/0801/frontend/yyyy/xxxx/src
15:19:19.648 INFO - Source encoding: UTF-8, default locale: en_US
15:19:19.691 INFO - Sensor JavaSourceImporter...
15:19:20.048 INFO - Sensor JavaSourceImporter done: 357 ms
15:19:20.048 INFO - Sensor JavaSquidSensor...
15:19:20.115 INFO - Java AST scan...
15:19:22.213 INFO - Java AST scan done: 2098 ms
15:19:22.354 INFO - Sensor JavaSquidSensor done: 2306 ms
15:19:22.354 INFO - Sensor SurefireSensor...
15:19:22.355 INFO - parsing /home/jsaluja/0801/frontend/yyyy/xxxx/.sonar/build/surefire-reports
15:19:22.355 INFO - Sensor SurefireSensor done: 1 ms
15:19:22.355 INFO - Sensor CpdSensor...
15:19:22.355 INFO - SonarEngine is used
15:19:22.360 INFO - Cross-project analysis disabled
15:19:22.635 INFO - Sensor CpdSensor done: 280 ms
15:19:22.636 INFO - Sensor CheckstyleSensor...
15:19:22.637 INFO - Execute Checkstyle 5.6...
15:19:22.648 INFO - Checkstyle configuration: /home/jsaluja/0801/frontend/yyyy/xxxx/.sonar/checkstyle.xml
15:19:23.990 INFO - Execute Checkstyle 5.6 done: 1353 ms
15:19:24.001 INFO - Sensor CheckstyleSensor done: 1365 ms
15:19:24.001 INFO - Sensor PmdSensor...
15:19:24.004 INFO - Execute PMD 4.3...
15:19:24.024 INFO - Java version: 1.5
15:19:24.066 INFO - PMD configuration: /home/jsaluja/0801/frontend/yyyy/xxxx/.sonar/pmd.xml
15:19:27.017 INFO - Execute PMD 4.3 done: 3013 ms
15:19:27.110 INFO - Sensor PmdSensor done: 3109 ms
15:19:27.110 INFO - Sensor InitialOpenIssuesSensor...
15:19:27.363 INFO - Sensor InitialOpenIssuesSensor done: 253 ms
15:19:27.363 INFO - Sensor ProfileSensor...
15:19:27.638 INFO - Sensor ProfileSensor done: 275 ms
15:19:27.638 INFO - Sensor ProfileEventsSensor...
15:19:27.654 INFO - Sensor ProfileEventsSensor done: 16 ms
15:19:27.655 INFO - Sensor ProjectLinksSensor...
15:19:27.660 INFO - Sensor ProjectLinksSensor done: 5 ms
15:19:27.660 INFO - Sensor VersionEventsSensor...
15:19:27.674 INFO - Sensor VersionEventsSensor done: 14 ms
15:19:27.674 INFO - Sensor JaCoCoSensor...
15:19:27.677 INFO - Project coverage is set to 0% since there is no directories with classes.
15:19:27.677 INFO - Sensor JaCoCoSensor done: 3 ms
15:19:28.164 INFO - Execute decorators...
15:19:31.041 INFO - Store results in database
15:19:31.214 INFO - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/a.b.c.d.xxxx
15:19:31.216 INFO - Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
15:19:31.230 INFO - Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
15:19:31.279 INFO - Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
15:19:31.288 INFO - -> Keep one snapshot per day between 2013-07-11 and 2013-08-07
15:19:31.289 INFO - -> Keep one snapshot per week between 2012-08-09 and 2013-07-11
15:19:31.289 INFO - -> Keep one snapshot per month between 2008-08-14 and 2012-08-09
15:19:31.289 INFO - -> Delete data prior to: 2008-08-14
15:19:31.292 INFO - -> Clean xxxx [id=11882]
15:19:31.296 INFO - <- Clean snapshot 13716
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 17.946s
Final Memory: 20M/732M
INFO: --------------------------------------------
The dashboard screenshot for the mvn and sonar runner executed for the same project
https://docs.google.com/file/d/0B2TK6N3XnvavRmdrX0ZYb2V3Q0k/edit?usp=sharing
Red one shows output for mvn - no LOC
Green one shows output for sonar runner - LOC and issues identified
What am i missing with mvn configuration ?
It seems that sonar does not find any class files
15:19:27.677 INFO - Project coverage is set to 0% since there is no directories with classes.
Did you run
mvn clean install -DskipTests
before mvn sonar:sonar as recommended? mvn sonar:sonar will not compile the source code anymore (I think since sonar 3.6).

Resources