2014-07-23 85 views
0

我們有一個使用apache-maven 3.0.5構建的多模塊項目。SonarQube - Maven的依賴問題

下面是設置:

  • 通過詹金斯運行聲納插件。
  • SonarQube服務器與MySQL駐留在另一臺計算機上。
  • 在Jenkins上使用聲納插件運行分析,然後將結果推送到SonarQube服務器。

以下是我在運行Sonar作業時收到的警告。

**這些警告似乎對服務器結果沒有影響。 SonarQube服務器顯示規則違規,並且沒有類似於在那裏丟失。

分析前:

[WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor: 
15:04:52 [WARNING] o com.company.product.plugins:com.company.product.external.libraries:jar:1.0.0-SNAPSHOT (provided) 
15:04:52 [WARNING] Try running the build up to the lifecycle phase "package" 
15:04:52 [WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor: 
15:04:52 [WARNING] o com.company.product.plugins:com.company.product.capturetool.core:jar:1.0.0-SNAPSHOT (provided) 

在分析過程中:

Class 'com/company/product/core/tools/ocraction/MyClass' is not accessible through the ClassLoader. 
    [WARN] [15:05:25.731] Class 'com/company/product/core/tools/ocraction/MyClass' is not accessible through the ClassLoader. 

經過分析:

[INFO] com.company.product.core.feature ................ SKIPPED 
[INFO] com.company.product.common.feature ... SKIPPED 
[INFO] My Product ............................... SKIPPED 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 

我很困惑,爲什麼發生這種情況。我沒有回答就在互聯網上搜索過。在Sonar分析之前,我已經收到諸如.m2目錄損壞等響應,而不是「mvn clean install」運行「mvn clean package」。

回答

0

我設法解決這個問題。我發現Sonar Jenkins插件本身並沒有真正運行「mvn clean install」命令。相反,它僅僅運行「mvn sonar:sonar」以及任何其他參數。

我在聲納的後期製作步驟之前執行了「mvn clean install」。這有助於解決我的問題。