SonarQube:“项目配置文件:无”

问题描述 投票:2回答:3

我已经配置了所有内容来对Maven项目进行声纳分析。一切都很好,直到我运行sonar-runner

     Max$ sonar-runner
     INFO: Scanner configuration file: /Users/Max/Documents/sonar-scanner-2.5/conf/sonar-runner.properties
     INFO: Project configuration file: NONE
     INFO: SonarQube Scanner 2.5
     INFO: Java 1.7.0_45 Oracle Corporation (64-bit)
     INFO: Mac OS X 10.10.3 x86_64
     INFO: User cache: /Users/Max/.sonar/cache
     INFO: Load global repositories
     INFO: Load global repositories (done) | time=143ms
     INFO: Property 'sonar.jdbc.url' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
     INFO: User cache: /Users/Max/.sonar/cache
     INFO: Load plugins index
     INFO: Load plugins index (done) | time=4ms
     INFO: Default locale: "fr_FR", source code encoding: "UTF-8" (analysis  is platform dependent)
     INFO: Process project properties
     INFO: ------------------------------------------------------------------------
     INFO: EXECUTION FAILURE
     INFO: ------------------------------------------------------------------------
     INFO: Total time: 1.631s
     INFO: Final Memory: 40M/194M
     INFO: ------------------------------------------------------------------------
     ERROR: Error during SonarQube Scanner execution
     ERROR: Unable to load component class org.sonar.batch.scan.ProjectLock
     ERROR: Caused by: Unable to load component class     org.sonar.api.batch.bootstrap.ProjectReactor
     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  Scanner with the -e switch.
     ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
  • 我在我的java项目文件夹中运行sonar-runner
  • 我在我的java项目中放置并配置了sonar-runner.properties sonar.projectKey=SeleniumMaven:sonar sonar.projectName=SeleniumMaven sonar.projectVersion=1.0 sonar.sources=src sonar.sourceEncoding=UTF-8 sonar.language=java

任何的想法?

java maven sonarqube sonar-runner sonarqube5.1
3个回答
4
投票

尝试传递这样的值:

sonar-runner -Dsonar.projectKey=..... -Dsonar.projectName=...

如果它工作,这意味着属性文件有点被忽略

如果您查看以下消息:

INFO: Scanner configuration file: /Users/Max/Documents/sonar-scanner-2.5/conf/sonar-runner.properties
INFO: Project configuration file: NONE

看起来您的项目配置文件确实被忽略了


4
投票

我有同样的问题,我意识到我的文件名不正确:而不是“sonar-project.properties”我把它作为“sonar-project.properties.properties”。

我会尝试将您的文件名更改为“sonar-project.properties”并尝试...


0
投票

您需要在项目的根目录中创建一个configuration file:sonar-project.properties

如果无法在项目的根目录中创建(或者您不知道)sonar-project.properties文件,则有several alternatives

  • 可以通过命令行直接指定属性。例如: sonar-scanner -Dsonar.projectKey = myproject -Dsonar.sources = src1
  • 属性project.settings可用于指定项目配置文件的路径(此选项与project.home和sonar.projectBaseDir属性不兼容)。例如: sonar-scanner -Dproject.settings = .. / myproject.properties

要分析的项目的根文件夹可以通过SonarQube Scanner 2.4(之前的project.home)之后的sonar.projectBaseDir属性进行设置。如果未在命令行中指定必需属性(如sonar.projectKey),则此文件夹必须包含sonar-project.properties文件。

Additional analysis parameters可以在此项目配置文件中定义,也可以通过命令行参数定义。

热门问题
推荐问题
最新问题