web-dev-qa-db-ja.com

ソナーセットアップ未定義の必須プロパティ

SonarQubeの使用方法を学習し、 here からクイックインストールを実行していました

ステップ5に進みました。実行するとビルドが失敗します:C:\ sonar-runner\bin\sonar-runner.bat

次のエラーが表示されます。

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 7.572s
Final Memory: 8M/223M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: You must define the following mandatory properties for 'Unknown':   sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.

誰もが同様の状況に遭遇して解決しましたか?

36
SeekingAlpha

Javaプロジェクトがある場合、ソナーランナーを実行するフォルダーにsonar-project.propertiesファイルを作成する必要があります。このファイル内で次のプロパティを定義する必要があります。

# Required metadata
sonar.projectKey=Java-sonar-runner-simple
sonar.projectName=Simple Java project analyzed with the SonarQube Runner
sonar.projectVersion=1.0

# Comma-separated paths to directories with sources (required)
sonar.sources=src

# Language
sonar.language=Java

# Encoding of the source files
sonar.sourceEncoding=UTF-8

お役に立てれば、

70
albciff

私にとっては、これが原因でした: https://stackoverflow.com/a/18779516/1068411

つまり、ソナーを「ビルド後のステップ」ではなく「ビルド後のアクション」に配置する必要があります。

5

CLIで同様の応答があり、すべてが正しくセットアップされていると推測する場合、私の問題はsonar-runnerコマンドは、プロジェクトディレクトリの外側から実行します。プロジェクトにcdがあることを確認してから、コマンドを実行します。

4
Hesam

ソナーのプロパティの下のジェンキンス内部では私のために働いた。

sonar.projectKey=MyWebApp
sonar.projectBaseDir=./MyWebApp
sonar.projectName=MyWebApp
sonar.projectVersion=1.0
sonar.sources=./src/main/Java
sonar.language=Java
sonar.Java.binaries=.
##to avoid this exception Caused by: org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001
sonar.scm.disabled=True
sonar.sourceEncoding=UTF-8

それが誰かを助けることを願っています。
ありがとう!

1
Anurag_BEHS