2016-02-10 38 views
0

我已經配置了所有內容以對Maven項目執行聲納分析。一切都很好,直到我跑sonar-runnerSonarQube:「項目配置文件:無」

 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. 
  • 我跑sonar-runner我的Java項目文件夾內
  • 我已經把在我的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 
    

有什麼想法?

+2

你爲什麼要使用聲納亞軍,如果你有一個Maven項目?只需使用Sonar Maven插件即可。 – Tunaki

回答

3

嘗試傳遞的價值觀是這樣的:

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 

看起來好像你的項目配置文件確實被忽略了

+1

非常感謝,它的工作!不知道爲什麼我的財產文件被忽略! – user3568978

+0

你是否從項目的根目錄運行命令? 但是,如@Tunaki所述,如果您的項目基於maven,則應使用sonar maven插件。 這樣你可以將分析附加到maven階段等。 –

1

我有同樣的問題,我意識到我的文件名是不正確的:而不是「sonar-project.properties」我把它作爲「sonar-project.properties.properties」。

我會試着改變你的文件名以「sonar-project.properties」,並嘗試...