sonarqube.gradle.plugin - 3.3
Sonar server Community Edition Version 8.5.1 (build 38104)
gradle - 7.1.1
run in gitlab 14.1.0
properties sonar.sources contains only 3 source folder,
/builds/top/top-application-status-informer/build/generated/wsdl,
/builds/top/top-application-status-informer/build/generated-sources/xjc,
/builds/top/top-application-status-informer/src/main/kotlin
I add excluded sources
Project configuration:
Excluded sources: **/build/**, **/.gradle/**
Excluded sources for coverage: **/configuration/**, **/const/**
But sonar analyzed folder with gradle caches and wrapper!
e[33mLongParameterList - 7/6 - [api] at /builds/top/top-application-status-informer/.gradle/caches/7.1.1/kotlin-dsl/accessors/67aa53bd12e1adf032ac55113cdf6a4d/sources/org/gradle/kotlin/dsl/ApiConfigurationAccessors.kt:118:28e[0m
e[33mLongParameterList - 7/6 - [annotationProcessor] at /builds/top/top-application-status-informer/.gradle/caches/7.1.1/kotlin-dsl/accessors/67aa53bd12e1adf032ac55113cdf6a4d/sources/org/gradle/kotlin/dsl/AnnotationProcessorConfigurationAccessors.kt:118:44e[0m
e[33mLongParameterList - 7/6 - [apiDependenciesMetadata] at /builds/top/top-application-status-informer/.gradle/caches/7.1.1/kotlin-dsl/accessors/67aa53bd12e1adf032ac55113cdf6a4d/sources/org/gradle/kotlin/dsl/ApiDependenciesMetadataConfigurationAccessors.kt:118:48e[0m
e[33mLongParameterList - 7/6 - [apiElements] at /builds/top/top-application-status-informer/.gradle/caches/7.1.1/kotlin-dsl/accessors/67aa53bd12e1adf032ac55113cdf6a4d/sources/org/gradle/kotlin/dsl/ApiElementsConfigurationAccessors.kt:122:36e[0m
Full logs build:
SonarQube.txt
Related
I installed below SonarQube version in Redhat 6 Serer.
Versions :
SonarQube : 6.3
Sonar Runner : 2.3
Sonar PHP Plugin : 2.10.0.2087
My project creates a PHPUnit Test Report in a Directory called "testreports"
sonar.project.properties:
# Required metadata
sonar.projectKey=Dashboard3
sonar.projectName=Dashboard3
sonar.projectVersion=2.0
#sonar.language=php
#Path to Source
sonar.sources=/pkg/vddfg/oradfg/apache/htdocs/Symfony/src/DB3
sonar.sourceEncoding=UTF-8
sonar.php.tests.reportPath=testReports/get_jfm_bug11s_test.xml
sonar.exclusions=**/Metro-UI-CSS-master/**
My Sonar executed successfully, by updating the line as Analyzing PHPUnit test report: testReports/get_jfm_bug11s_test.xml but in SonarQube dashboard we unable to find the Test Report.
How to fix this issue?
1) Use the JUnit output format for your tests (PHPUnit configuration):
<log type="junit" target="tests.xml"/>
2) Add "sonar.tests" to your Sonar properties:
sonar.tests=/path/to/tests
I am trying to add SonarQube analysis to our OSS Project with travis on Github.
I performed the following steps:
Create a organization and project on sonarcloud.io
Add the sonarcloud definition in .travis.yml
Create a sonar-project.properties file
Push everything to a feature branch called feature/sonarcloud
Add this branch to travis.yml and properties file.
The final result can be seen here:
https://github.com/open62541/open62541/tree/feature/sonarcloud
Unfortunately Travis does not submit the sonar analysis:
INFO: Scanner configuration file:
/home/travis/.sonarscanner/sonar-scanner-2.8/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner analysis skipped
(See also https://travis-ci.org/open62541/open62541/jobs/287631673)
I already tried to forcefully set export SONARQUBE_SKIPPED=false but it is still skipped. How can I find out why the scanner analysis is skipped?
Related questions:
SonarQube Scanner analysis skipped in travis CI
Travis CI skipping SonarQube analysis
As you can read in the Travis CI logs, at line 556:
Skipping SonarCloud Scan because this branch is not master or it does not match declared branches
This is because you haven't activated analysis on that "feature/sonarcloud" branch. As described in the official documentation, you can achieve that like this:
addons:
sonarcloud:
organization: open62541
token:
secure: "..."
branches:
- master
- feature/sonarcloud
We run Sonar coverage analysis for multi-module Java projects in a Jenkins environment using the sonar-maven-plugin. We noticed that the coverage analysis results displayed on our Sonar dashboard are not correct for a handful of source files. One odd finding from my investigation is that I when I run the analysis from my local development laptop, the coverage analysis is correct (Sonar dashboard updated with the correct coverage percentages for those source files). Has anyone encountered any issues like this before?
Clarification:
The differences in the coverages are mostly between 0 and non-zero percent coverage. But I also see a couple of instances where the difference is between non-zero and non-zero percent coverage. Also, the differences correspond to source files from random packages, not any specific package. We are encountering this issue across various Sonar projects as well (so not just an issue specific to one of our Sonar project).
Also, when I import the Jacoco exec data file into Eclipse (using eclemma plugin), I do see the correct coverage percentages (non-zero). Furthermore, the coverage result when running the analysis locally can also be incorrect when compared with the result as interpreted by the EclEmma plugin). So, now it seems the analysis results may be incorrect regardless of which environments I run the analysis from (assuming the analysis result from EclEmma is correct).
Not sure why the coverage results is wrong only for a handful of the source files. I have compared both the client-side console logs and server side (Sonar server) logs -- but did not find any clues (no indication of error, both analysis were successful). I have also compared the coverages-xxx.pb files' sizes from the batch-report folder, but did not find any differences either.
Thanks in advance to anyone with suggestions on how I can troubleshoot this further! Please let me know if any additional information regarding the execution environments would be helpful.
Thanks,
Thinh
SONAR ENVIRONMENT:
- sonar-maven-plugin version: 3.3.0.603
- SonarQube version: 5.6.6
- sonar.java.source: 1.8
- sonar.java.target: 1.8
- sonar.sourceEncoding: UTF-8
SonarQube plugins:
- Findbugs 3.5 (findbugs)
- SonarJava 4.11.0.10660 (java)
- Git 1.2 (scmgit)
JENKINS ENVIRONMENT:
- Jenkins version: CloudBees Jenkins Enterprise 2.46.3.2-rolling
- Maven version: 3.1.1
- Java version: OpenJDK 64-bit Server 1.8.0_141
- Slave OS: 64-bit, CentOS (Red Hat 4.4.7-11), Linux version
2.6.32-504.12.2.el6.x86_64
LOCAL LAPTOP ENVIRONMENT:
- Maven version: 3.1.1
- Java version: Java HotSpot(TM) 64-Bit Server VM
(build 1.8.0_60-b27)
- OS: macOS Sierra, version 10.12.5
I am currently using the sonarqube server 5.6 with scanner 2.6.1 and I keep getting errors during analysis for a java project.
It appears to complain about some java files not compiled in the binaries folder (there aren't any at all in the binaries folder).
Once I add the -X parameter I get more exceptions (flagged as ignored), see below.
any clues?
sonar-project.properties followed by logs
sonar.projectKey=myproj
sonar.projectName=myproj
sonar.projectVersion=1.1
sonar.branch=1.1
sonar.sources=./java
sonar.binaries=./deploy
sonar.log.level=DEBUG
sonar.verbose=false
sonar.sourceEncoding=UTF-8
INFO: Execute Checkstyle 6.12.1 done: 2365 ms
INFO: Sensor CheckstyleSensor (done) | time=2377ms
INFO: Sensor SCM Sensor (wrapped)
INFO: SCM provider for this project is: svn
INFO: 9 files to be analyzed
DEBUG: Working directory: D:\Apps\xxxx
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
DEBUG: Annotate file java/src/xxxx.java
INFO: 9/9 files analyzed
INFO: Sensor SCM Sensor (wrapped) (done) | time=3289ms
INFO: Sensor FindBugs Sensor (wrapped)
WARN: Findbugs needs sources to be compiled. Please build project before
executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your project.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
execution without the -e param
WARN: Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbto analyse your project.
then
java.lang.IllegalStateException: Can not execute Findbugs
Caused by: java.lang.IllegalStateException: This project contains Java source files that are not compiled.
at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:120)
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.
with the -X parameter
com.puppycrawl.tools.checkstyle.api.CheckstyleException: missing key 'severity' in SuppressionCommentFilter
then multiple exceptions
DEBUG: Keep looking, ignoring exception
com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to find class for com.puppycrawl.tools.checkstyle.checks.sizes.WhitespaceAroundCheck
then
WARN: Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for
then
INFO: EXECUTION FAILURE
It works for me after defining :
sonar.java.binaries=[YOUR_BUILD_DIR] (target/classes)
seen in :
https://github.com/SonarQubeCommunity/sonar-findbugs/issues/49
We had the same issue for some projects (mainly Play Framework projects). I reverted the FindBugs plugin in SonarQube from version 3.4.3 to 3.3 (that I used on SonarQube 5.5) and then the analysis worked again.
My working configuration for SonarQube 6.2 with Maven-Multi-Module project
Parent
-- Module1
-- Module2
sonar.projectKey=projectKey
sonar.projectName=Project Name
sonar.projectVersion=1.0
sonar.modules=Module1,Module2
sonar.sources=src
sonar.sourceEncoding=UTF-8
sonar.language=java
I am very new to Sonar and in the process of setting up my first server/project.
Environment:
OS: Windows Server 2008 R2 / amd64 / 6.1
App Server: Tomcat/7.0.40I, deployed the Sonar WAR file (3.5.1).
DB: MySQL 5.6.11
(relevant) Plugins:
Sonar C++ Community Plugin (0.2)
The plugin is visible under General Settings --> Sonar C++ Community Plugin
sonar-project.properties
# Required metadata
sonar.projectKey=test:pmc
sonar.projectName=PMC
sonar.projectVersion=1.0
sonar.language=c++
# Comma-separated paths to directories with sources (required)
sonar.sources=c:/SVN/Development/test/PMC/trunk/AppServer,c:/SVN/Development/test/PMC/trunk/PmcShared,c:/SVN/Development/test/PMC/trunk/WebServer,c:/SVN/Development/test/PMC/trunk/Tools
# Optional path to the CppCheck program required to activate some CppCheck rules
sonar.cpp.cppcheck.path=C:/Program Files (x86)/Cppcheck/cppcheck.exe
# Encoding of the source files
sonar.sourceEncoding=UTF-8
The thing I do not understand is that it cannot find a plugin that supports the 'cxx' language:
C:\Users\Administrator\Documents\sonar-projects\PMC>sonar-runner
C:\Users\Administrator\Documents\sonar-runner-2.2.1
Sonar Runner 2.2.1
Java 1.7.0_21 Oracle Corporation (64-bit)
Windows Server 2008 R2 6.1 amd64
INFO: Runner configuration file: C:\Users\Administrator\Documents\sonar-runner-2.2.1\conf\sonar-runner.properties
INFO: Project configuration file: C:\Users\Administrator\Documents\sonar-projects\PMC\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: C:\Users\Administrator\Documents\sonar-projects\PMC\.sonar
INFO: Sonar Server 3.5.1
15:20:54.231 INFO - Load batch settings
15:20:54.794 INFO - User cache: C:\Users\Administrator\.sonar\cache
15:20:54.797 INFO - Install plugins
15:20:55.742 INFO - ------------- Executing Project Scan
15:20:56.482 INFO - Install JDBC driver
15:20:56.487 INFO - Apply project exclusions
15:20:56.493 INFO - Create JDBC datasource for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
15:20:56.771 INFO - Initializing Hibernate
15:20:59.229 INFO - ------------- Inspecting PMC
15:20:59.229 INFO - Load module settings
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 6.162s
Final Memory: 13M/221M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: You must install a plugin that supports the language 'cxx'
ERROR:
ERROR: To see the full stack trace of the errors, re-run Sonar Runner with the -e switch.
ERROR: Re-run Sonar Runner using the -X switch to enable full debug logging.
I do have the Sonar C++ Community Plugin installed so I guess I am missing the obvious...could someone please help me getting started?
It seems I made a mistake in the configuration file. I re-created it and now the job runs! This issue is closed and the configurations above will work.
I had a similar error with the C# plugin:
ERROR: Caused by: You must install a plugin that supports the language 'cs '
Please remark the 'cs '
After long time I spotted the extra ' ' after 'cs'. When removing the extra space in the configuration file it worked. It seems like sonar-runner don't use "trim".
For new users, if you still getting this error (SonarQube 4+) start the server, go to the 'Settings' ( top right ) then search for 'Update center' there you add missing modules , next restart Server. it should works
Source: Link from official project website
To find the string required to activate any given SonarQube language plugin, go to "Settings" -> "System" -> "Update Center". For each plugin, the short name will be in square brackets to the right of the human-readable name.
C / C++ / Objective-C [cpp]
In this example, "cpp" is the name to use in the sonar.language property in your sonar-project.properties.