Jenkins安裝配置
Jenkins是一個開源軟件項目,旨在提供一個開放易用的軟件平臺,使軟件的持續集成變成可能
Jenkins是基於Java開發的一種
持續集成工具,用於監控持續重複的工做,功能包括:
一、持續的軟件版本發佈/測試項目。
二、監控外部調用執行的工做。
首先保證系統中已經安裝了jdk
第一種啓動方法:
切換到jenkins.war存放的目錄,輸入以下命令:
1
|
java -jar jenkins.war
|
而後在瀏覽器中輸入localhost:8080,localhost能夠是本機的ip,也能夠是計算機名。就能夠打開jenkins
第二種方法是:用tomcat打開,將jenkins.war文件放入tomcat下的webapps目錄下,啓動jenkins時,
會自動在webapps目錄下創建jenkins目錄,因此在地址欄上須要輸入的地址於上一種方法有點不同,
輸入:localhost:8080/jenkins。
下面咱們用第二種方法啓動jenkins。
啓動tomcat,瀏覽輸入localhost:8080/jenkins。Windows環境下。
![](http://static.javashuo.com/static/loading.gif)
初始的管理員密碼,jenkins自動生成的,根據上面紅色的路徑找到密碼,拷到下面的輸入框中。
![](http://static.javashuo.com/static/loading.gif)
安裝插件,能夠默認的安裝,也能夠本身選擇,(jenkins配置好後也能夠安裝插件)這裏咱們選擇默認的。javascript
![](http://static.javashuo.com/static/loading.gif)
完了之後到建立用戶
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
完了之後進入jenkins的主頁
![](http://static.javashuo.com/static/loading.gif)
"系統管理"---->"Global Tool Configuration" 配置 jdk 、maven等信息
![](http://static.javashuo.com/static/loading.gif)
點擊「jdk安裝」 配置jdk信息
![](http://static.javashuo.com/static/loading.gif)
Maven配置
![](http://static.javashuo.com/static/loading.gif)
接下來咱們「構建一個maven項目」。
點擊-「新建「
![](http://static.javashuo.com/static/loading.gif)
出現一下界面
![](http://static.javashuo.com/static/loading.gif)
選擇「可選插件」
安裝完後再去「新建」
![](http://static.javashuo.com/static/loading.gif)
項目名稱等基本信息
![](http://static.javashuo.com/static/loading.gif)
添加svn信息,
若是沒有svn的選項就是沒有安裝svn插件,去安裝插件。若是安裝了git插件這裏也有git選項。
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
點擊 「Add」 填寫svn帳號和密碼
![](http://static.javashuo.com/static/loading.gif)
完成後
![](http://static.javashuo.com/static/loading.gif)
添加構建後操做
![](http://static.javashuo.com/static/loading.gif)
直接將構建好的項目打包部署到tomcat中
![](http://static.javashuo.com/static/loading.gif)
添加tomcat,該toamat是部署項目的
![](http://static.javashuo.com/static/loading.gif)
固然了 tomcat中要配置用戶名和密碼,該用戶還要有足夠的權限,下面是個人tomcat的配置
在tomcat-user.xml中配置的
<role rolename="admin" /> <role rolename="admin-gui" /> <role rolename="manager" /> <role rolename="manager-script" /> <role rolename="manager-gui" /> <user username="admin" password="123456" roles="admin,manager,manager-script,manager-gui,admin-gui"/> 用戶名爲admin 密碼爲 123456
在 My Views 能看到本身建的項目
![](http://static.javashuo.com/static/loading.gif)
進入項目後,
點擊「當即構建」就會執行構建任務,jenkins就會從svn上將代碼拉下來,打好包後而後部署到tomcat上,這一切都是jenkins完成的。
![](http://static.javashuo.com/static/loading.gif)