문제

I have setup Sonar and want to run the code analysis as part of my nightly build.

I've setup the nightly build but I'm having some issues with running the sonar runner.

To run code analysis I want to navigate to a folder I've created called \BuildAssets, inside the main solution folder. To run the code analysis manually I would open up a command prompt within \BuildAssets and run: %SONAR_RUNNER_HOME%\Bin\sonar-runner.bat

How would I set this up in CCNET?

I've tried:

<exec> 
  <executable>%SONAR_RUNNER_HOME%\bin\sonar-runner.bat</executable>
  <baseDirectory>BuildAssets</baseDirectory>
  <buildTimeoutSeconds>$(slowBuildTimeout)</buildTimeoutSeconds>
</exec>

but this doesn't work because it tries to run c:\cc\myBuild\code\BuildAssets\%SONAR_RUNNER_HOME%\bin\sonar-runner.bat

I also tried:

<exec> 
  <executable>cmd</executable>
  <baseDirectory>BuildAssets</baseDirectory>
  <buildArgs>%SONAR_RUNNER_HOME%\bin\sonar-runner</buildArgs>
  <buildTimeoutSeconds>$(slowBuildTimeout)</buildTimeoutSeconds>
</exec>

but this doesn't seem to do anything either. I'm sure it's pretty easy but I'm not well versed in CCNET configuration.

도움이 되었습니까?

해결책

I was missing the /C from the build args element, so I got this working with:

<exec> 
  <executable>c:\Windows\System32\cmd.exe</executable>
  <baseDirectory>BuildAssets</baseDirectory>
  <buildArgs>/C %SONAR_RUNNER_HOME%\bin\sonar-runner</buildArgs>
  <buildTimeoutSeconds>$(slowBuildTimeout)</buildTimeoutSeconds>
</exec>

다른 팁

I suppose SONAR_RUNNER_HOME is the environment variable. If so, you should reference it like this: $(SONAR_RUNNER_HOME).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top