sonarLint與IntelliJ IDEA 集成

SonarQube下載https://www.sonarqube.org/downloads/

一.安裝SonarQube

將來下載的SonarQube解壓打開bin目錄,啟動(dòng)相應(yīng)OS目錄下的StartSonar。使用的是win的32位系統(tǒng),則打開D:\sonarqube-5.6.6\sonarqube-5.6.6\bin\windows-x86-32\StartSonar.bat

啟動(dòng)瀏覽器訪問 http://localhost:9000 出現(xiàn)sonarqube界面則說明安轉(zhuǎn)成功

sonarqube

二、配置

1、1.打開mysql,新建一個(gè)數(shù)據(jù)庫。

mysql

2、打開sonarqube安裝目錄下的D:\sonarqube-5.6.6\sonarqube-5.6.6\conf\sonar.properties文件

再mysql5.6 下添加

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

sonar.jdbc.username=root

sonar.jdbc.password=***

sonar.sorceEncoding=UTF-8

sonar.login=admin

sonar.password=admin

4.重啟sonarqube服務(wù),再次訪問http://localhost:9000,會(huì)稍微有點(diǎn)慢,因?yàn)橐跏蓟瘮?shù)據(jù)庫信息

5.數(shù)據(jù)庫初始化成功后,登錄

6.進(jìn)入插件安裝頁面

chinese pack

7、chinese pack 安裝成功后重啟服務(wù)。

三、Connected Mode

1、file->setting->other setting 配置sonarqube servers

sonarqube servers

2、test connect error

connection

3、更新sonarjava跟sonarjs

update?

4、新建項(xiàng)目

正在上傳...取消

5、綁定idea項(xiàng)目至sonaerqube 項(xiàng)目

bing project

6、執(zhí)行。

執(zhí)行后在idea的控制臺(tái)可以看到sonar lint 的結(jié)果。但是在服務(wù)器上無法看到結(jié)果???

四、通過maven來執(zhí)行

1、配置maven

pom.xml

<plugin>

? ? ? ? <groupId>org.sonarsource.scanner.maven</groupId>

? ? ? ? <artifactId>sonar-maven-plugin</artifactId>

? ? ? ? <version>3.2</version>

? ? ? </plugin>

? ? ? <plugin>

setting.xml

<profiles>


? ? ? <profile>

? ? ? ? ? <id>sonar</id>

? ? ? ? ? <activation>

? ? ? ? ? ? ? <activeByDefault>true</activeByDefault>

? ? ? ? ? </activation>

? ? ? ? ? <properties>

? ? ? ? ? ? ? <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar</sonar.jdbc.url>

? ? ? ? ? ? ? <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>

? ? ? ? ? ? ? <sonar.jdbc.username>root</sonar.jdbc.username>

? ? ? ? ? ? ? <sonar.jdbc.password>jkzl123456</sonar.jdbc.password>

? ? ? ? ? ? ? <sonar.host.url>http://localhost:9000</sonar.host.url>

? ? ? ? ? </properties>

? ? ? </profile>

</profiles>

?<pluginGroups>

? ? ? ? <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>

? ? </pluginGroups>

2、控制臺(tái)執(zhí)行mvn clean install ,mvn sonar:sonar

3、打開localhost:9000

maven webapp
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容