0

I'm running sonar scan with following versions:

  • ant v3.0.5
  • sonar v4.5.4
  • sonar-ant-task v2.3

My ant project contains 100+ submodules; about half of them have external libs, and half don't

In my ant build file, following sonar properties are set:

sonar.projectKey = com.foo:bar
sonar.projectName = foobar
sonar.projectVersion = ${build.version.major}.${build.version.minor}.${build.version.subminor}
sonar.sourceEncoding=UTF-8
sonar.language = java
sonar.sources = src
sonar.java.binaries = build/classes
sonar.java.libraries = build/dependency/*.jar

Initial problem with above is that for the modules that don't have external libs, it fails since there's no jar inside /build/dependency after compilation.

According to this archive link: http://sonarqube-archive.15.x6.nabble.com/Analysis-aborts-because-of-quot-No-files-nor-directories-matching-lib-jar-quot-td5035215.html

I should be able to change the libraries property to

sonar.java.libraries = build/dependency/*

But this did not work for the combination of app versions i listed above. Using only "*" results in class not found error so i don't even think it correctly grabs the dependency jar files.

Could anyone advise if i'm using incorrect combination of the versions, or if this have regressed?

My current workaround:

Keep the "*.jar" as default project property, and add individual module's libraries property to the empty folder for those that do not have dependency jar. e.g.

module1.sonar.projectName=module1
module1.sonar.projectBaseDir=modules/module1
module1.sonar.java.libraries=build/dependency
module2.sonar.projectName=module2
module2.sonar.projectBaseDir=modules/module2
module2.sonar.java.libraries=build/dependency
... x 50 more of these

Is there more elegant solution?

thanks, Scott

Scott Chang
  • 301
  • 4
  • 11

2 Answers2

1

sonar.java.libraries property is handled by the SonarQube Java plugin. Please provide its version and if it is not the latest try to update.

  • the SonarQube Java plugin is at v3.3.the server admin is a distant team in the company. i will have to request for the update, but a confirmation whether the version will actually make a difference will help build my case. – Scott Chang Jan 29 '16 at 19:31
0

You're on the right track. The analysis of Java multi-module projects is only easy for Maven users. :-(

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76