Ok I have solved it, maybe you can document this script in your documentation when other developers have the same challenge as that I had:
The Sonarqube documentation really misses NPM Angular/Nodejs docs.
The important thing is if you run it you need to run it in a nodejs environment. The ‘NodeJSAuto’ setting is in Jenkins configured in the manage Jenkins --> Global tool configuration.
pipeline {
agent any
stages {
stage('Sonar Analyse') {
steps {
nodejs(nodeJSInstallationName: 'NodeJSAuto', configId: '') {
// sonar script moet je in een nodejs module draaien !!
script {
withSonarQubeEnv('My server') {
def scannerHome = tool 'sonarScanner';
sh "${scannerHome}/bin/sonar-scanner"
}
}
}
}
}
}
}
And you need to add the sonar-project.properties file in the root of your projectdoc(In my case Angular) :
// project id in Sonarqube
sonar.projectKey=tnextest1
sonar.projectVersion=1.0
//location Angular source files who need to be analysed by Sonarqube
sonar.sources=src/app
If anybody has better ideas I would like to hear about it
Kind regards
Ben