After having worked on one of my project for the first time in months, I wanted to run Sonar to check whether I introduced any new violations. As I have done lots of times before, I've first downloaded the latest stable version of Sonar (sonarqube-4.5.2) And subsequently ran the project with mvn sonar:sonar
Everything worked with the Sonar way profile such that I decided to switch to the Findbugs profile. However while analysing the project, I received the following warning:
[WARN] [13:21:45.287] 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.
I had never encountered this problem before (on the same project, but with older versions of sonar), so I searched on the Internet and found that I might need to define sonar.binaries
to point Sonar to the compiled classes. (It looks like in my case, Sonar figured this out automatically in the past). Nevertheless I added to my pom.xml
the following properties:
<sonar.sources>${basedir}/src/org/myproject</sonar.sources>
<sonar.binaries>${basedir}/target/classes/org/myproject</sonar.binaries>
<sonar.java.binaries>${basedir}/target/classes/org/myproject</sonar.java.binaries>
<sonar.tests>${basedir}/test/org/myproject</sonar.tests>
However, I still get the same error while seeing that the sonar.binaries
now explicitly points to Maven's target folder.
[INFO] [15:18:46.496] Source paths: src/org/myproject
[INFO] [15:18:46.496] Test paths: test/org/myproject
[INFO] [15:18:46.496] Binary dirs: target/classes/org/myproject
What I have tried to far:
- Downloaded sonarqube-5.0 which doesn't work at all
- Modified my
pom.xml
to incorporate the following sonar properties- sonar.sources --> points to src/org/myproject
- sonar.binaries --> points to target/classes/org/myproject
- sonar.java.binaries --> points to target/classes/org/myproject
- sonar.tests --> points to test/org/myproject
- Tried the same properties, but with absolute paths. I also tried to only specify the path to the parent folders (src, test, target). No success
- I've added a
sonar-project.properties
file with various properties to the project, without any success - Compiling the project using various Maven lifecycles before running
mvn sonar:sonar
I'm really perplexed since this worked like a charm in the past.