sonarqube + lombok = false positives

This case should be perfectly handled by SonarJava. Lombok annotations are taken into account at least since version 3.14 (SONARJAVA-1642). The issues you are getting are resulting from a misconfiguration of your Java project. No need to write any custom rules to handle this, this is natively supported by the analyzer. SonarJava reads bytecode to … Read more

Analyzing Android Project with Lint and SonarQube

I had success with a multimodule android project. Since the complete build files take too much space I show the relevant parts here only. In the parent project’s build.gradle I set: buildscript { … dependencies { classpath ‘com.android.tools.build:gradle:1.5.0’ … } plugins { id “org.sonarqube” version “1.1” } In the app project (and any other children) … Read more

Please provide compiled classes of your project with sonar.java.binaries

You’re running your Maven steps in the wrong order: clean – delete all previous build output sonar:sonar – run analysis (which requires build output) deploy – build &etc… Try this instead: mvn clean deploy sonar:sonar Now if you’re about to object that you don’t want to actually “deploy” the jar until/unless the changed code passes … Read more

Configure Sonar to exclude files from Maven pom.xml

Sonar exclusions (like other sonar properties) have to be added to the <properties> section of the POM file. Like so (example from excluding jOOQ autogenerated code from current project): <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <sonar.host.url>http://www.example.com/</sonar.host.url> <sonar.jdbc.url>jdbc:postgresql://www.example.com/sonar</sonar.jdbc.url> <sonar.jdbc.driver>org.postgresql.Driver</sonar.jdbc.driver> <sonar.jdbc.username>sonar</sonar.jdbc.username> <sonar.jdbc.password>sonar</sonar.jdbc.password> <sonar.exclusions>org/binarytherapy/generated/**/*, **/GuiceBindComposer.java</sonar.exclusions> <sonar.dynamic>reuseReports</sonar.dynamic> </properties>

Why does the Maven command “mvn sonar:sonar” work without any plugin configuration in my “pom.xml”?

The reason is that the Sonar Maven Plugin is hosted at the Codehaus Mojo project and benefits from the groupId “org.codehaus.mojo”. This allows to use the shortcut “sonar:sonar” instead of “org.codehaus.mojo:sonar-maven-plugin::sonar” (see the section “Configuring Maven to Search for Plugins” of the Maven documentation)

New Integer vs valueOf

Integer.valueOf implements a cache for the values -128 to +127. See the last paragraph of the Java Language Specification, section 5.1.7, which explains the requirements for boxing (usually implemented in terms of the .valueOf methods). http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.1.7

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)