java.lang.NullPointerException: The property "sonar.cs.ndepend.projectPath" must be set (to an absolute path)

215 views Asked by At

Like in a previous post: NDepend SonarQube integration generates java.lang.NullPointerException, when trying to integrate NDepend 6.3 into SonarQube 6.1, a NullPointerException is generated:

java.lang.NullPointerException: The property "sonar.cs.ndepend.projectPath" must be set (to an absolute path)

In the administration page, under configuration (NDepend Tab) there are three Keys: enter image description here

  • NDepend Rules
  • NDepend execution timeout
  • Path to NDepend.SonarQube.RuleRunner.exe

I've followed these instructions: , but I can't find how to set the sonar.cs.ndepend.projectPath. When I execute NDepend.SonarQube.RuleRunner.exe through the command prompt, specifying the .ndproj path and report file locations, the analysis runs perfectly. But, through the NDepend Sonarqube plugin executed via a build in VSTS, it generates the error.

I've also tried to add the arguments for the project path and report file after the absolute path I specify for the Path to NDepend.SonarQube.RuleRunner.exe textbox in the NDepend tab, under the Administration Panel / configuration page of the SonarQube server. Just like you would if running through the command prompt. But, the arguments aren't parsed as they are when running through a command prompt. They are just seen as part of the absolute path.

I can see where the three keys are set in this file: SonarQubeAnalysisConfig.xml located on my LFS here: G:\SonarQube\bin\vsts-agent-win7-x64-2.109.1\_work\2\.sonarqube\conf. This file is generated every time a build is started in VSTS. So, I can't set the sonar.cs.ndepend.projectPath there.

So, my question is: Where can I specify the sonar.cs.ndepend.projectPath? So, that value is picked up and used?

2

There are 2 answers

0
jessehouwing On

When using the Hosted Build you'll need to commit NDepend to source control or download it as part of your build workflow, extract it and put the license file along side it. After doing that, you can use it from the build.

0
Patrick from NDepend team On

If you use the online VSTS, it's not possible to launch the NDepend analysis because it must not exist in the build machine. However if you use VSTS with onprem instances you can follow the instructions as described in our doc and specify the sonar.cs.ndepend.projectPath in the param of the "SonarQube Scanner for MSBuild- End Analysis" task.