SonarQube 6.3 fails on trying to scan a binary file - maven

after successfully upgrading from sonarqube 6.2 to 6.3 the analyzation process of one project fails. The error message is Unable to read the source file : '.../ajax.gif' with the charset : 'UTF-8'. Input length = 1. When I run file .../ajax.gif then I get GIF image data, version 89a, 220 x 19 as expected. Before upgrading to 6.3 everything was working fine.
Here is the complete output:
CLI command: mvn clean sonar:sonar
Outcome:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building pp-scratch 1.1.17-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.2:sonar (default-cli) # pp-scratch ---
[INFO] User cache: /home/thomas/.sonar/cache
[INFO] Load global settings
[INFO] Load global settings (done) | time=235ms
[INFO] User cache: /home/thomas/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=9ms
[INFO] Plugin [l10nde] defines 'l10nen' as base plugin. This metadata can be removed from manifest of l10n plugins since version 5.2.
[INFO] SonarQube version: 6.3.0
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=124ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=85ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=539ms
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=103ms
[INFO] Publish mode
[INFO] Project key: de.tln:pp-scratch
[INFO] ------------- Scan pp-scratch
[INFO] Excluded sources for coverage:
[INFO] **/*DTO.java
[INFO] Load server rules
[INFO] Load server rules (done) | time=97ms
[INFO] Initializer GenericCoverageSensor
[INFO] Initializer GenericCoverageSensor (done) | time=0ms
[INFO] Base dir: /home/thomas/workspace/aexit/pp-scratch
[INFO] Working dir: /home/thomas/workspace/aexit/pp-scratch/target/sonar
[INFO] Source paths: src/main/webapp, pom.xml, src/main/java
[INFO] Test paths: src/test/java
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] Excluded sources:
[INFO] **/*.min.css
[INFO] **/*.min.js
[INFO] src/main/webapp/resources/bootstrap/**
[INFO] **/entity/*.java
[INFO] 210 files indexed
[INFO] 7 files ignored because of inclusion/exclusion patterns
[INFO] Quality profile for css: Sonar way
[INFO] Quality profile for java: TLN
[INFO] Quality profile for js: Sonar way
[INFO] Quality profile for web: Sonar way
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.309 s
[INFO] Finished at: 2017-03-24T08:18:22+01:00
[INFO] Final Memory: 61M/514M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project pp-scratch: Unable to read the source file : '/home/thomas/workspace/aexit/pp-scratch/src/main/webapp/resources/app/ajaxloadingbar.gif' with the charset : 'UTF-8'. Input length = 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1

You are facing the following bug: SONAR-8995
It will be fixed in SonarQube 6.3.1.

Related

Unknown lifecycle phase ".qualitygate.wait=true"

I am trying to integrate SonarQube with GitLab CI but I get the following error:
[ERROR] Unknown lifecycle phase ".qualitygate.wait=true". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site
I have a Spring Boot project with Maven.
I edited the Maven settings.xml like in the documentation to add sonar in it.
This is my Log file:
Running with gitlab-runner 13.3.1 (738bbe5a)
on Default runner 77Lxte6S
Preparing the "shell" executor
00:00
Using Shell executor...
Preparing environment
00:00
Running on DESKTOP-CMAC9J3...
Getting source from Git repository
00:02
Fetching changes...
Reinitialized existing Git repository in C:/Fontys/CI Runner/builds/77Lxte6S/0/I426015/its_georgi_manev_s3/.git/
Checking out 6fddf4a4 as master...
Removing target/
git-lfs/2.9.2 (GitHub; windows amd64; go 1.12.7; git 0274d856)
Skipping Git submodules setup
Restoring cache
Version: 13.3.1
Git revision: 738bbe5a
Git branch: 13-3-stable
GO version: go1.13.8
Built: 2020-08-25T12:29:07+0000
OS/Arch: windows/386
Checking cache for sonarqube-check...
Runtime platform arch=386 os=windows pid=14048 revision=738bbe5a version=13.3.1
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.
Successfully extracted cache
Executing "step_script" stage of the job script
00:23
$ mvn verify sonar:sonar -Dsonar.qualitygate.wait=true
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< com.its:ITS >-----------------------------
[INFO] Building ITS 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # ITS ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # ITS ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to C:\Fontys\CI Runner\builds\77Lxte6S\0\I426015\its_georgi_manev_s3\target\classes
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) # ITS ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Fontys\CI Runner\builds\77Lxte6S\0\I426015\its_georgi_manev_s3\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # ITS ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Fontys\CI Runner\builds\77Lxte6S\0\I426015\its_georgi_manev_s3\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # ITS ---
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) # ITS ---
[INFO] Building jar: C:\Fontys\CI Runner\builds\77Lxte6S\0\I426015\its_georgi_manev_s3\target\ITS-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.3.4.RELEASE:repackage (repackage) # ITS ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] ----------------------------< com.its:ITS >-----------------------------
[INFO] Building ITS 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.7.0.1746:sonar (default-cli) # ITS ---
[INFO] User cache: C:\Fontys\CI Runner\builds\77Lxte6S\0\I426015\its_georgi_manev_s3\.sonar\cache
[INFO] SonarQube version: 8.5.0
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Load global settings
[INFO] Load global settings (done) | time=87ms
[INFO] Server id: BF41A1F2-AXUskNJ7IDe8fi-slcI-
[INFO] User cache: C:\Fontys\CI Runner\builds\77Lxte6S\0\I426015\its_georgi_manev_s3\.sonar\cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=55ms
[INFO] Load/download plugins (done) | time=106ms
[INFO] Process project properties
[INFO] Process project properties (done) | time=10ms
[INFO] Execute project builders
[INFO] Execute project builders (done) | time=3ms
[INFO] Project key: com.its:ITS
[INFO] Base dir: C:\Fontys\CI Runner\builds\77Lxte6S\0\I426015\its_georgi_manev_s3
[INFO] Working dir: C:\Fontys\CI Runner\builds\77Lxte6S\0\I426015\its_georgi_manev_s3\target\sonar
[INFO] Load project settings for component key: 'com.its:ITS'
[INFO] Load project settings for component key: 'com.its:ITS' (done) | time=16ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=48ms
[INFO] Auto-configuring with CI 'Gitlab CI'
[INFO] Load active rules
[INFO] Load active rules (done) | time=1041ms
[INFO] Indexing files...
[INFO] Project configuration:
[INFO] 8 files indexed
[INFO] 0 files ignored because of scm ignore settings
[INFO] Quality profile for java: Java NO CORS
[INFO] Quality profile for xml: Sonar way
[INFO] ------------- Run sensors on module ITS
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=20ms
[INFO] Sensor JavaSquidSensor [java]
[INFO] Configured Java source version (sonar.java.source): 11
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=12ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=6ms
[INFO] Java Main Files AST scan
[INFO] 6 source files to be analyzed
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=14ms
[INFO] 6/6 source files have been analyzed
[INFO] Java Main Files AST scan (done) | time=1659ms
[INFO] Java Test Files AST scan
[INFO] 1 source files to be analyzed
[INFO] Java Test Files AST scan (done) | time=66ms
[INFO] 1/1 source files have been analyzed
[INFO] Java Generated Files AST scan
[INFO] 0 source files to be analyzed
[INFO] Java Generated Files AST scan (done) | time=1ms
[INFO] 0/0 source files have been analyzed
[INFO] Sensor JavaSquidSensor [java] (done) | time=1884ms
[INFO] Sensor CSS Rules [cssfamily]
[INFO] No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
[INFO] Sensor CSS Rules [cssfamily] (done) | time=2ms
[INFO] Sensor JaCoCo XML Report Importer [jacoco]
[INFO] 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
[INFO] No report imported, no coverage information will be imported by JaCoCo XML Report Importer
[INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=5ms
[INFO] Sensor C# Properties [csharp]
[INFO] Sensor C# Properties [csharp] (done) | time=1ms
[INFO] Sensor SurefireSensor [java]
[INFO] parsing [C:\Fontys\CI Runner\builds\77Lxte6S\0\I426015\its_georgi_manev_s3\target\surefire-reports]
[INFO] Sensor SurefireSensor [java] (done) | time=78ms
[INFO] Sensor JavaXmlSensor [java]
[INFO] 1 source files to be analyzed
[INFO] Sensor JavaXmlSensor [java] (done) | time=185ms
[INFO] 1/1 source files have been analyzed
[INFO] Sensor HTML [web]
[INFO] Sensor HTML [web] (done) | time=4ms
[INFO] Sensor XML Sensor [xml]
[INFO] 1 source files to be analyzed
[INFO] Sensor XML Sensor [xml] (done) | time=114ms
[INFO] 1/1 source files have been analyzed
[INFO] Sensor VB.NET Properties [vbnet]
[INFO] Sensor VB.NET Properties [vbnet] (done) | time=1ms
[INFO] ------------- Run sensors on project
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=10ms
[INFO] Sensor Java CPD Block Indexer
[INFO] Sensor Java CPD Block Indexer (done) | time=24ms
[INFO] SCM Publisher SCM provider for this project is: git
[INFO] SCM Publisher 1 source file to be analyzed
[INFO] SCM Publisher 1/1 source file have been analyzed (done) | time=211ms
[INFO] CPD Executor 3 files had no CPD blocks
[INFO] CPD Executor Calculating CPD for 3 files
[INFO] CPD Executor CPD calculation finished (done) | time=7ms
[INFO] Analysis report generated in 79ms, dir size=106 KB
[INFO] Analysis report compressed in 137ms, zip size=27 KB
[INFO] Analysis report uploaded in 39ms
[INFO] ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=com.its%3AITS
[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://localhost:9000/api/ce/task?id=AXVAanQEcFRPLb2nDbPG
[INFO] Analysis total time: 5.924 s
[INFO]
[INFO] ----------------------------< com.its:ITS >-----------------------------
[INFO] Building ITS 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.449 s
[INFO] Finished at: 2020-10-19T12:31:59+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase ".qualitygate.wait=true". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
ERROR: Job failed: exit status 1
This happens only when I run the pipeline while when I run mvn verify sonar:sonar -Dsonar.qualitygate.wait=true in cmd I dont get any errors.
Here is the log from cmd (shortened):
[INFO] Scanning for projects...
[INFO]
[INFO] ------< com.its:ITS >---------
[INFO] Building ITS 0.0.1-SNAPSHOT
[INFO] =----------[ jar ]-------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # ITS ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # ITS ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) # ITS ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\Eclipse IDE n gfish\eclipseWorkSpace\ddemorest\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # ITS ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # ITS ---
[INFO]
[INFO] ----------< com.its:ITS >--------
[INFO] Building ITS 0.0.1-SNAPSHOT
[INFO] ------[ jar ]---------
[INFO]
[INFO] --- sonar-maven-plugin:3.7.0.1746:sonar (default-cli) # ITS ---
[INFO] User cache: C:\Users\Joro\.sonar\cache
[INFO] SonarQube version: 8.5.0
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Load global settings
[INFO] Load global settings (done) | time=79ms
[INFO] Server id: BF41A1F2-AXUskNJ7IDe8fi-slcI-
[INFO] User cache: C:\Users\Joro\.sonar\cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=76ms
[INFO] Load/download plugins (done) | time=154ms
[INFO] Process project properties
[INFO] Process project properties (done) | time=17ms
[INFO] Execute project builders
[INFO] Execute project builders (done) | time=4ms
[INFO] Project key: com.its:ITS
[INFO] Base dir: E:\Eclipse IDE n gfish\eclipseWorkSpace\ddemorest
[INFO] Working dir: E:\Eclipse IDE n gfish\eclipseWorkSpace\ddemorest\target\sonar
[INFO] Load project settings for component key: 'com.its:ITS'
[INFO] Load project settings for component key: 'com.its:ITS' (done) | time=20ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=96ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=1057ms
[INFO] Indexing files...
[INFO] Project configuration:
[INFO] 8 files indexed
[INFO] 0 files ignored because of scm ignore settings
[INFO] Quality profile for java: Java NO CORS
[INFO] Quality profile for xml: Sonar way
[INFO] ------------- Run sensors on module ITS
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=21ms
[INFO] Sensor JavaSquidSensor [java]
[INFO] Configured Java source version (sonar.java.source): 11
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=18ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=8ms
[INFO] Java Main Files AST scan
[INFO] 6 source files to be analyzed
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=20ms
[INFO] 6/6 source files have been analyzed
[INFO] Java Main Files AST scan (done) | time=1670ms
[INFO] Java Test Files AST scan
[INFO] 1 source files to be analyzed
[INFO] Java Test Files AST scan (done) | time=68ms
[INFO] 1/1 source files have been analyzed
[INFO] Java Generated Files AST scan
[INFO] 0 source files to be analyzed
[INFO] Java Generated Files AST scan (done) | time=6ms
[INFO] 0/0 source files have been analyzed
[INFO] Sensor JavaSquidSensor [java] (done) | time=1931ms
[INFO] Sensor CSS Rules [cssfamily]
[INFO] No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
[INFO] Sensor CSS Rules [cssfamily] (done) | time=9ms
[INFO] Sensor JaCoCo XML Report Importer [jacoco]
[INFO] 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
[INFO] No report imported, no coverage information will be imported by JaCoCo XML Report Importer
[INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=21ms
[INFO] Sensor C# Properties [csharp]
[INFO] Sensor C# Properties [csharp] (done) | time=7ms
[INFO] Sensor SurefireSensor [java]
[INFO] parsing [E:\Eclipse IDE n gfish\eclipseWorkSpace\ddemorest\target\surefire-reports]
[INFO] Sensor SurefireSensor [java] (done) | time=84ms
[INFO] Sensor JavaXmlSensor [java]
[INFO] 1 source files to be analyzed
[INFO] Sensor JavaXmlSensor [java] (done) | time=153ms
[INFO] 1/1 source files have been analyzed
[INFO] Sensor HTML [web]
[INFO] Sensor HTML [web] (done) | time=7ms
[INFO] Sensor XML Sensor [xml]
[INFO] 1 source files to be analyzed
[INFO] Sensor XML Sensor [xml] (done) | time=122ms
[INFO] 1/1 source files have been analyzed
[INFO] Sensor VB.NET Properties [vbnet]
[INFO] Sensor VB.NET Properties [vbnet] (done) | time=6ms
[INFO] ---- Run sensors on project
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=14ms
[INFO] Sensor Java CPD Block Indexer
[INFO] Sensor Java CPD Block Indexer (done) | time=25ms
[INFO] CPD Executor 3 files had no CPD blocks
[INFO] CPD Executor Calculating CPD for 3 files
[INFO] CPD Executor CPD calculation finished (done) | time=9ms
[INFO] Analysis report generated in 103ms, dir size=105 KB
[INFO] Analysis report compressed in 117ms, zip size=27 KB
[INFO] Analysis report uploaded in 44ms
[INFO] ------Check Quality Gate status
[INFO] Waiting for the analysis report to be processed (max 300s)
[INFO] QUALITY GATE STATUS: PASSED - View details on http://localhost:9000/dashboard?id=com.its%3AITS
[INFO] Analysis total time: 11.358 s
[INFO] BUILD SUCCESS
This is my .gitlab-ci.yml configuration:
maven_build:
stage: test
script:
- echo "Maven build started"
- echo "$TEST"
- mvn verify
sonarqube-check:
image: maven:3.6.3-jdk-11
variables:
SONAR_TOKEN: "hidden"
SONAR_HOST_URL: "http://localhost:9000"
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- mvn verify sonar:sonar -Dsonar.qualitygate.wait=true
allow_failure: true
only:
- merge_requests
- master
- develop
The correct answer:
-mvn clean install
-mvn "-Dsonar.qualitygate=true" sonar:sonar
The -Dsonar.qualitygate=true should be in quotes and after mvn.
Apparently it was some problem with windows shell.
You are probably missing quotes.

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;

Issue with SonarQube 5.6.5 and Maven

For the last few days, I try to have SonarQube working on my local with a very simple Maven project. I didn't want to start with one of my project, but I wanted to start from a tutorial. So, I re-used the following Github project:
https://github.com/mechero/code-quality-game
And I downloaded and installed SonarQube 5.6.5 on my local. The first message that I received was this one:
objc[57607]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java (0x10adf04c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10aeb84e0). One of the two will be used. Which one is undefined.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building code-quality-game 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.2:sonar (default-cli) # code-quality-game ---
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load global repositories
[INFO] Load global repositories (done) | time=322ms
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=5ms
[INFO] SonarQube version: 5.6.5
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=29ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=169ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=717ms
[INFO] Publish mode
[INFO] ------------- Scan code-quality-game
[INFO] Load server rules
[INFO] Load server rules (done) | time=156ms
[INFO] Base dir: /Users/benjamin.chevallerea/Downloads/code-quality-game/sonar-connector
[INFO] Working dir: /Users/benjamin.chevallerea/Downloads/code-quality-game/sonar-connector/target/sonar
[INFO] Source paths: pom.xml, src/main/java
[INFO] Test paths: src/test/java
[INFO] Binary dirs: target/classes
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] Excluded sources:
[INFO] **/resultbeans/*.java
[INFO] 36 files indexed
[INFO] 5 files ignored because of inclusion/exclusion patterns
[INFO] Quality profile for java: Sonar way
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.979 s
[INFO] Finished at: 2017-02-16T11:21:42+00:00
[INFO] Final Memory: 68M/1963M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project code-quality-game: Unable to load component class org.sonar.java.SonarComponents: org/springsource/loaded/ri/ReflectiveInterceptor: org.springsource.loaded.ri.ReflectiveInterceptor -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
By logging to the UI, I noticed that there was a new version for the Java plugin. So, I updated it and I deleted my local cache and restarted. Then, I got this error:
objc[57893]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java (0x10ebdc4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10eca44e0). One of the two will be used. Which one is undefined.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building code-quality-game 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.2:sonar (default-cli) # code-quality-game ---
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load global repositories
[INFO] Load global repositories (done) | time=312ms
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=6ms
[INFO] SonarQube version: 5.6.5
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=36ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=130ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=719ms
[INFO] Publish mode
[INFO] ------------- Scan code-quality-game
[INFO] Load server rules
[INFO] Load server rules (done) | time=174ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.843 s
[INFO] Finished at: 2017-02-16T11:27:11+00:00
[INFO] Final Memory: 64M/1963M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project code-quality-game: Unable to load component class org.sonar.batch.sensor.DefaultSensorStorage: Unable to load component class org.sonar.batch.issue.ModuleIssues: Unable to load component class org.sonar.batch.issue.IssueFilters: Unable to load component class org.sonar.java.filters.PostAnalysisIssueFilter: org/springsource/loaded/ri/ReflectiveInterceptor: org.springsource.loaded.ri.ReflectiveInterceptor -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
So I uploaded all plugins in SonarQube, but same issues. Because the problem is with the sensor, I decided to force the language to Java by adding the following property:
<sonar.language>java</sonar.language>
And now, I have the following error:
objc[58166]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java (0x1090c54c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10918d4e0). One of the two will be used. Which one is undefined.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building code-quality-game 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.2:sonar (default-cli) # code-quality-game ---
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load global repositories
[INFO] Load global repositories (done) | time=191ms
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=4ms
[INFO] SonarQube version: 5.6.5
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=26ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=50ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=431ms
[INFO] Publish mode
[INFO] ------------- Scan code-quality-game
[INFO] Language is forced to java
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.123 s
[INFO] Finished at: 2017-02-16T11:32:37+00:00
[INFO] Final Memory: 67M/1963M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project code-quality-game: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar: org/springsource/loaded/TypeRegistry
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/benjamin.chevallerea/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.2/sonar-maven-plugin-3.2.jar
[ERROR] urls[1] = file:/Users/benjamin.chevallerea/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[2] = file:/Users/benjamin.chevallerea/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[3] = file:/Users/benjamin.chevallerea/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[4] = file:/Users/benjamin.chevallerea/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[5] = file:/Users/benjamin.chevallerea/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[6] = file:/Users/benjamin.chevallerea/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[7] = file:/Users/benjamin.chevallerea/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.8/sonar-scanner-api-2.8.jar
[ERROR] urls[8] = file:/Users/benjamin.chevallerea/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[9] = file:/Users/benjamin.chevallerea/.m2/repository/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.springsource.loaded.TypeRegistry
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
And I'm stuck on this error for few days now. I even tried to do exactly the same on a fresh new SpringBoot app and same issue.
Thanks in advance if you can help me.
Ben
The problem has been solved. Nothing related to SonarQube or Java. I realized that the variable MAVEN_HOME was not configured properly. Thanks for your help.

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.

java project not getting analysed in sonar 3.3.5

When I give mvn sonar:sonar for sample java project in sonar I get this error.The sample project is from link
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simple Java Maven Project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:2.0:sonar (default-cli) # example-java-maven ---
[INFO] Sonar version: 3.5.1
[INFO] [12:29:59.781] Load batch settings
[INFO] [12:30:00.000] User cache: C:\Documents and Settings\xxx\.sonar\cache
[INFO] [12:30:00.156] Install plugins
INFO] [12:30:03.250] ------------- Executing Project Scan
[INFO] [12:30:04.500] Install JDBC driver
INFO] [12:30:04.515] Apply project exclusions
[WARN] [12:30:04.531] H2 database should be used for evaluation purpose only
[INFO] [12:30:04.531] Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
[INFO] [12:30:04.890] Initializing Hibernate
[INFO] [12:30:09.500] ------------- Inspecting Simple Java Maven Project
[INFO] [12:30:09.515] Load module settings
[INFO] [12:30:09.937] Excluded tests:
[INFO] [12:30:09.937] **/package-info.java
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.125s
[INFO] Finished at: Thu Jun 13 12:30:11 IST 2013
[INFO] Final Memory: 9M/28M
[INFO] ------------------------------------------------------------------------
ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (d
efault-cli) on project example-java-maven: Can not execute Sonar: You must insta
ll a plugin that supports the language 'java' -> [Help 1]
ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
Should I manually put any plugin to analyze java project?
It looks like you have removed the Java plugins from your Sonar home directory. You can upload the latest version at http://docs.codehaus.org/display/SONAR/Java+Ecosystem, copy the plugins into SONAR_HOME/extensions/plugins and restart your Sonar server.

Resources