iOS開發 jenkins(DRYPlugin)+PMD/CPD 檢測重複程式碼
阿新 • • 發佈:2018-12-14
1、搭建 jenkins
參考:http://blog.csdn.net/xiaofei125145/article/details/51144827?locationNum=1
2、安裝 DRY 外掛
DRY Plug-in
3、下載 PMD
https://sourceforge.net/projects/pmd/files/pmd/
4、解壓PMD並放置到 指定目錄下
我放置到了 ~/PMD/ 目錄下
5、新建並配置 jenkins 專案
1 自由風格的軟體專案
2 配置好 svn 或者 git 倉庫地址
3 新增構建步驟
Execute shell
export HEAPSIZE=4096m ~/PMD/pmd-bin-5.5.1/bin/run.sh cpd --minimum-tokens 100 --format xml --language ObjectiveC --encoding UTF-8 --files Pods --skip-duplicate-files > cpd.xml || exit 0
請不要直接 copy shell 程式碼,看不懂該shell程式碼的同學參看
PMD/CPD 使用幫助文件連結
https://pmd.github.io/pmd-5.5.1/usage/cpd-usage.html
4 新增構建後操作並配置 Duplicate code results 目錄,注意參考 構建shell 中的 我配置的內容請看圖
> cpd.xml 選擇 Publish duplicate code analysis results (如果沒有安裝 jenkins dry 外掛,健不會有這個 選項)
配置好之後如圖:
PMD/CPD 使用幫助文件連結
https://pmd.github.io/pmd-5.5.1/usage/cpd-usage.html ---------------------