maven connecting to Sonar
Running sonar with mvn sonar:sonar -Dsonar.jdbc.url=jdbc:h2:tcp://ipaddr:9092/sonar -Dsonar.host.url=http://ipaddr:9000 ,where ipaddr is your remote host, seems to work.
Running sonar with mvn sonar:sonar -Dsonar.jdbc.url=jdbc:h2:tcp://ipaddr:9092/sonar -Dsonar.host.url=http://ipaddr:9000 ,where ipaddr is your remote host, seems to work.
I had the same issue when using sonar maven plugin and jacoco test reports. mvn sonar:sonar relies on an existintig jacoco report, when the source code was changed (lines had been removed), but the test report wasn’t updated this error occurred. Running mvn clean test sonar:sonar solved it.
You can’t replace the lambda input -> getValueProvider().apply(input).getValue() with a method reference without changing the semantics. A method reference replace a single method invocation, so it can’t simply replace a lambda expression consisting of more than one method invocation. A lambda expression of the form input -> getValueProvider().apply(input) could be replaced by getValueProvider()::apply if, and … Read more
I found the solution – The maven plugin I have included has configuration of Jacoco’s destfile and datafile as ${basedir}/target/coverage-reports/jacoco-unit.exec but by default sonar reads at ${basedir}/target/jacoco.exec. I changed the default at http://localhost:9000/settings?category=java Ref: Sonar Code Coverage Couldn’t find the working reference link. Here is aux link: Baeldung Sonar and jacoco
The right way to do is to put something like this on sonar-project.properties file per project: sonar.issue.ignore.multicriteria=e1,e2 # tab characters should not be used sonar.issue.ignore.multicriteria.e1.ruleKey=squid:S00105 sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.java # right curly braces should be on a new line sonar.issue.ignore.multicriteria.e2.ruleKey=squid:RightCurlyBraceStartLineCheck sonar.issue.ignore.multicriteria.e2.resourceKey=**/*.java There are docs here on how to ignore specific rules for specific files, which links to an … Read more
With a newer SonarQube installation, you can use sonar.cpd.exclusions to exclude certain files only from duplicate checks. See: https://docs.sonarqube.org/latest/analysis/analysis-parameters/ Example: sonar.cpd.exclusions=**/AssemblyInfo.cs,**/*.g.cs,**/Mappings/*.cs
Just an update to this the new link is here: https://docs.sonarqube.org/latest/instance-administration/security/#header-3 As it says on the link you can do this: In case you lost the admin password of your SonarQube instance, you can reset it by executing the following query: PostgreSQL and Microsoft SQL Server update users set crypted_password=’100000$t2h8AtNs1AlCHuLobDjHQTn9XppwTIx88UjqUm4s8RsfTuXQHSd/fpFexAnewwPsO6jGFQUv/24DnO55hY6Xew==’, salt=”k9x9eN127/3e/hf38iNiKwVfaVk=”, hash_method=’PBKDF2′, reset_password=’true’, user_local=”true” where … Read more
Issue was in the wrapper.conf where the java wrapper command was not getting resolved. It worked if I give the absolute path – ‘wrapper.java.command=/path/to/my/jdk/bin/java’ This could be an issue with an environment on a host.. not sure. Few things that helped me in troubleshooting this – log level changed to DEBUG in wrapper.conf comments given … Read more
Summing up the above mentioned answers and also adding one point to it. To exclude a project from SonarQube Analysis from csproj we can achieve by adding the below code in .csproj of that project <PropertyGroup> <!– Exclude the project from analysis –> <SonarQubeExclude>true</SonarQubeExclude> </PropertyGroup> To exclude a file from a project <ItemGroup> <SonarQubeSetting Include=”sonar.coverage.exclusions”> … Read more
As dotnet core projects (.csproj) will not have <ProjectGuid>…</ProjectGuid> tag specified in the default template this needs to be manually added. So you need to edit the .csproj file like this: <PropertyGroup> <!– other properties here –> <!– SonarQube needs this –> <ProjectGuid>{E2CEBBAF-6DF7-41E9-815D-9AD4CF90C844}</ProjectGuid> Make sure to place your own GUID inside the <ProjectGuid>…</ProjectGuid> Tag