Jenkins関連の記事をいろいろ掲載していますが、やりたかったことを実施しているのが、この記事になります。事前準備の詳細は他の関連記事を参照してください。
事前準備
pom.xml
使用しているpom.xml、および動作確認環境は、こちらの記事のものとなります。
使用しているソース
Jenkinsジョブの設定
Jenkinsジョブの設定については、こちらの記事を参照してください。
ビルド実行
準備が整ったら、ビルドします。
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc01.png)
ビルド結果の確認
ビルド履歴からビルド結果を参照します。
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc02.png)
Checkstyle
まずは、Checkstyleの結果確認。
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc03.png)
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc04-1.png)
Checkstyleの警告が表示されています。
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc04-2.png)
SpotBugs
続いて、SpotBugsの結果確認。
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc04-3.png)
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc05-1.png)
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc05-2.png)
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc05-3.png)
カバレッジ
続いて、カバレッジの結果確認。
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc05-4.png)
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc06-1.png)
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc06-2.png)
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc06-3.png)
JUnit
続いて、JUnitテスト結果確認。
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc06-4.png)
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc07-1.png)
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc07-2.png)
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc07-3.png)
2+2=3 ではないので、テスト失敗しています。ソースコードは以下の通りです。
![](http://itbibo.starfree.jp/wp-content/themes/cocoon-child-master/images/jenkins/exe/JenkinsExc07-4.png)
ウェブサイトでの結果確認
ビルド実行で出力された結果をウェブサイトで確認する方法は、こちらの記事にまとめています。