新的声纳。到目前为止,我能够在jenkins中配置我的sonarqube服务器,并使用以下代码运行maven应用程序。
withSonarQubeEnv('sonarserver') {
sh 'mvn clean package sonar:sonar'
}
这将成功运行,并执行分析和maven构建,并生成一个war文件。此外,我可以在sonarqube页面中看到分析
现在我正试图为.net核心应用程序做同样的事情。我安装了sonarscanner如下link
第一步成功运行,我得到:
dotnet tool install --global dotnet-sonarscanner
Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed.
You can invoke the tool using the following command: dotnet-sonarscanner
所以我接下来创建了以下代码:
withSonarQubeEnv('sonarserver') {
sh '''
dotnet-sonarscanner begin /k:"proyject-key" //key was generated in sonarqube x new proj.
dotnet build solution.sln
dotnet-sonarscanner end
'''
但现在我得到了:
+ dotnet-sonarscanner begin /k:project-key
/var/lib/jenkins/workspace/sonar-test-dotnet@tmp/durable-00ff368b/script.sh: 3: /var/lib/jenkins/workspace/sonar-test-dotnet@tmp/durable-00ff368b/script.sh: dotnet-sonarscanner: not found
[Pipeline] }
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
2条答案
按热度按时间guz6ccqo1#
根据你提到的文档,执行的命令应该是:
而不是:
将
dotnet-sonarscanner
替换为dotnet sonarscanner
。kdfy810k2#
这个阶段为我工作。
......