2015-05-14 34 views
9

https://github.com/Pablissimo/SonarTsPluginsonarqube打字稿插件:「您必須安裝支持該語言插件」我試圖建立SonarQube使用這個插件來分析我的打字稿項目

不過,我遇到一個錯誤,如:

> C:\sonarqube\sonar-runner-2.4\bin\sonar-runner.bat 
... 
INFO: 
------------------------------------------------------------------------ 
INFO: EXECUTION FAILURE 
INFO: ------------------------------------------------------------------------ 
Total time: 3.006s 
Final Memory: 18M/613M 
INFO: ------------------------------------------------------------------------ 
ERROR: Error during Sonar runner execution 
ERROR: Unable to execute Sonar 
ERROR: Caused by: You must install a plugin that supports the language 'typescript' 
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. 

我的設置: - Windows 7的64位 - JDK8(1.8.0)64位 - SonarQube 5.1 64位

我已經建立了從源代碼插件,並複製產生.jar文件到我的SonarQube安裝C:\sonarqube\sonarqube-5.1\extensions\plugins\sonar-typescript-plugin-0.1-SNAPSHOT.jar

SonarQube正在運行並服務於端口9000,我可以在設置 - >系統 - >更新中心看到TypeScript插件已安裝,語言關鍵字爲typescript

基於this post,看來我必須:

登錄到你的聲納實例,單擊「設置」>「質量概況」和你想要的語言標題的頂部「創建」使用。

看着這些設置,我看到一個Typescript Profiles標題,以定義並設置爲默認值的TsLint輪廓。

最後,在我的項目的根目錄下,我有一個文件sonar-project.properties

# Required metadata 
sonar.projectKey=my-ts-project 
sonar.projectName=A TypeScript Project 
sonar.projectVersion=1.0 

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

# Language 
sonar.language=typescript 

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

有了所有這些配置,我還收到了聲納亞軍錯誤「您必須安裝支持該語言插件」 。

我錯過了什麼?

編輯:

我嘗試安裝了JavaScript的插件,和我看到了同樣的問題。所以這不僅限於TypeScript。我可以針對Java項目運行Sonar,但沒有其他語言似乎能夠工作。

回答

9

好的,我想出瞭如何解決這個特定的問題。我的sonar-project.properties中的密鑰sonar.language應設置爲ts,而不是typescript

# Language 
sonar.language=ts 

我想通了這一點通過查看對應的javascript插件示例項目:https://github.com/SonarSource/sonar-examples/blob/master/projects/languages/javascript/javascript-sonar-runner/sonar-project.properties。這裏,語言設置爲js而不是javascript

我必須猜測,一般來說,語言鍵應該設置爲源文件的正常文件擴展名?即Java - > .java,JavaScript - > .js,TypeScript - > .ts ...如果是這樣,那麼這並不明顯。有什麼方法可以確認這種預感嗎?

3

這裏是可能sonar.language值

C# => "cs" 
CSS => "css" 
SCSS => "scss" 
Less => "less" 
Java => "java" 
Web => "web" 
XML => "xml" 
JSON => "json" 
JavaScript => "js" 

安裝所需的插件和運行使用-X開關掃描儀,你可以找到在聲納記錄必要的值。

相關問題