Error executing sonar scannner in Jenkins

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this
    I am trying to execute a Sonar scanner step in a Jenkins job, but my i keep getting an error relating to sonar scanner execution, i am not sure what the issue is. i have added screenshots.

Hi,

Welcome to the community!

It looks like you passed something on the analysis command line that wasn’t flagged as a parameter (i.e. preceded with -D), so the scanner took it as an argument naming a task.

If you look at your analysis command line and it’s not obvious what the problem is, feel free to share it here.

 
Ann

Thanks Ann, here is what my analysis command line looks like;
sonar.language=java
sonar.projectVersion=1.0
sonar.java.binaries= **/*.java
sonar.verbose=true
sonar.projectKey=sonarqubeprojectkey
sonar.host.url=https://sonarqube.xxx.com
sonar.projectName=XXX
sonar.sourceEncoding=UTF-8
sonar.analysis.mode=publish
sonar.buildbreaker.skip=true

#path to source directory
sonar.sources= /var/lib/jenkins/workspace/$JOB_NAME/xxx/src

Hi,

That’s your analysis parameters, not the command that launches analysis. It’s the command that launches analysis that I need to see.

 
Ann

i got the scanner to move past the error, thanks, i built the project with maven and added the target/class file path to sonar.binaries and excluded the .h files with sonar.exclude