Wednesday 29 January 2014

SonarQube analysis with Maven for a JavaScript project with multiple source directories

Here is how I convinced SonarQube to analyze a Maven JavaScript project with multiple source directories.

As SonarQube by default is using the standard Maven source directory (src/main/java) (and also ignoring the property "sonar.sources" when running from Maven) I had to specify the source directory of my webapp and then use the property "sonar.inclusions" to specify in which subdirectories of my webapp directory my JavaScript source files reside. Here is an excerpt from my POM:


 <properties>
  ...
  <sonar.language="">js</sonar>
  <sonar.inclusions="">app/**,astCommon/**</sonar>
  ...

 <build>
  <sourcedirectory>src/main/webapp</sourcedirectory>
  ...