SonarQube configuration in the Oracle Jet project - sonarqube

I'm trying to configure my Oracle JET based project to the sonar qube. On executing sonar-scanner command I ended up with following error:
ERROR: Language of file 'src\js\path_mapping.json' can not be decided as the file matches patterns of both sonar.lang.patterns.gscan.t13y : **/*.wptg,**/*.properties,**/*.rts,**/*.xlf,**/*.xliff,**/*.xrts,**/*.dlf,**/*.msg,**/*.resx,**/*.rc,**/*.yaml,**/*.yml,**/*.json,**/*.txt,**/*.strings and sonar.lang.patterns.json : **/*.json
I tried to override the files association by setting up the following in project properties file:
sonar.json.file.suffixes=.json
This couldn't help either. Getting the same error again.
As I don't have access to sonar admin module, I need to achieve it though project properties only.
Is there any other way to fix it? I did not find any concrete answer anywhere.

Related

Error during SonarQube Scanner execution

I'm running sonar-runner inside my project folder
I have put and configured the sonar-runner.properties in my project as well. But still the execution Sonar failed. Any idea as to what could be the problem ?
If project configuration file(sonar-project-properties) is being ignored then what is the workaround. Pl suggest asap.
This error is telling you that the Scanner is not finding your project properties. That is likely because the default name of the file is not sonar-runner.properties, nor sonar-project-properties, but sonar-project.properties.

Gradle Plugin for SonarQube fails with error related to accessExternalSchema

For several of our projects, we get the following error, when using the Sonar Gradle plugin (http://docs.sonarqube.org/display/SONAR/Analyzing+with+Gradle).
11:26:16.744 ERROR - Error parsing XML: XML InputStream(5) schema_reference: Failed to read schema document 'persistence_1_0.xsd', because 'http' access is not allowed due to restriction set by the accessExternalSchema property.
We have run into this previously when running xjc tasks, and I tried to adapt the solution there, resulting in the following:
sonarqube {
System.setProperty('javax.xml.accessExternalSchema', 'all')
}
This however, didn't appear to have any effect.
Any suggestions on how to fix the problem?
Thanks!
You could maybe try to apply same workaround than How to surpass gradle wsimport task JDK 8 access restrictions?
Anyway in SonarQube 5.2 there will be no more database connection so no more persistence.xml.

Unit test code analysis using "sonar.*" property and maven-sonar-plugin

I'm trying to do code analysis of Java unit test using maven sonar plugin. But the plugin doesn't seem to take into account my sonar properties "sonar.*". I've tried to modify simple examples and it did work either. According to MSONAR-70, the issue has been fixed and I'm using the version 2.4.
For the test, I've tried it on a simple case:
Clone sonar-examples.git
use the project sonar-examples/projects/languages/java/maven/java-maven-simple as example
Renamed src/main to src/test
In the pom.xml, add to the properties section :
<sonar.sources>src/test/java</sonar.sources>
<sonar.binaries>target/test-classes</sonar.binaries>
Run mvn sonar:sonar.
--> the code analysis didn't took into account my settings. The project is created on SonarQube but code as not been analyzed.
If I use the sonar-runner command line, it's analyzing the code:
sonar-runner [...] -Dsonar.sources=src/test/java
-Dsonar.binaries=target/test-classes
-Dsonar.language=java
-Dsonar.sourceEncoding=UTF-8
-Dsonar.projectKey=org.codehaus.sonar:example-java-maven
-Dsonar.projectName="Simple Java Maven Project"
-Dsonar.projectVersion=1.0-SNAPSHOT
According to a previous revision of the question, the OP solved their problem like this:
We were using SonarQube 4.0 version. Updating the version to 4.4, made the properties be taken into account.
That was in 2014; the current version now is 5.5.
The steps to upgrade can be found here:
Stop the old SonarQube server
Download and unzip the new SonarQube distribution in a fresh directory, let's say NEW_SONARQUBE_HOME.
Start it using the default H2 database and use the update center to install the plugins you need.
Manually install any custom plugins.
Stop the new server.
Update the content of the sonar.properties and wrapper.conf files located in the NEW_SONARQUBE_HOME/conf directory with the content of the related files in the OLD_SONARQUBE_HOME/conf directory (web server URL, database settings, etc.). Do not copy-paste the old files.
If a custom JDBC driver is used, copy it into NEW_SONARQUBE_HOME/extensions/jdbc-driver/.
Back up your database.
Remove the data/es directory.
Start the new web server
Browse to http://localhost:9000/setup (replace "localhost:9000" with your own URL) and follow the setup instructions.

The Findbugs configuration file is not valid Error While uploading rule file to sonarQube

I have an issue when creating a new profile in sonarqube-4.1.2. Here is at I did:
I have sonar 3.1 rt now, that has 461 rules. Did a back up and saved the rule files containing rules for checkstyle. pmd and findbug.
I did try to create a new profile by clicking on "Create" in 4.1.2. It give me error
The Findbugs configuration file is not valid : profile : profile [hide]
I also tried to Restore Profile which also is not importing the right number of rules. restoring only 345 rules.
In the log I see this error:
ERROR [o.s.p.f.FindbugsProfileImporter] The Findbugs configuration file is not valid
com.thoughtworks.xstream.mapper.CannotResolveClassException: profile : profile
at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:68) ~[xstream-1.3.1.jar:na]
Please suggest what can be done to fix this.
I found this unanswered question when searching on the same issue. Do not use Create, use Restore Profile link above it for profile backups.

set configuration properties in sonar

Maybe, this question is silly but I'm very new. I try to search without luck.
I got two errors when building maven project with sonar:
No information about coverage per test.
Although I had test code and these testing classes cover the code.
The global property 'sonar.doxygen.deploymentPath' is not set. Set it in SONAR and run another analysis.
I dont know it should be set where in sonar server. I set in web.xml or sonar-server.properties but it does not work.
Thanks.
About the first warning message this is not an error but a warning : since Sonar 3.5 this is possible to get the code coverage relating to each unit test. Here the message just says that this feature is not activated which is expected by default. Nevertheless I do agree that this warning message can be misleading.
About the second error message, I don't know the doxygen plugin but the message seems to be pretty clear : the sonar.doxygen.deploymentPath property has not be defined. See the plugin documentation : http://docs.codehaus.org/display/SONAR/Doxygen+Plugin.
Two things:
There is no war folder anymore since the sonarqube has given up tomcat support
The doxygen plugin is not implemented to upload the files in to the sonarqube server &/ installation, which means it only can be done by referencing the path inside your installation, e.g.:
run "mvn install sonar:sonar" in your project "/root/test.example.sonar.com"
in sonarqube set the cfg-key "sonar.doxygen.deploymentPath" the value: "/root/sonarqube-4.1.1/web/" and the cfg-key "sonar.doxygen.deploymentUrl" the value: "http://:9000"
have fun with your doxygen
Remember that the plugin will only be run through your mvn cmd, refreshing the page only will not do the job, you will have to analyse again after each cfg set :/
Check the file system and folder permission

Resources