轉自 https://www.cnblogs.com/hdwang/p/6081994.htmlhtml
==============================web
安裝插件:算法
1 maven插件 2 tomcat自動部署插件 Deploy to container Plugin shell
一 建立maven 項目apache
二 添加賬號
獲取代碼 1svn賬號 2 tomcat部署賬號 ubuntu
Credentials->system->點擊tomcat
Global credentials (unrestricted) |
Add Credentials安全
填入UserName: deploy
password:deploy服務器
三 配置tomcat部署app
1 到你的tomcat,配置 tomcat-users.xml
配置角色
<role rolename="manager-gui" />
<role rolename="manager-script"/>
<user username="deploy" password="deploy" roles="manager-gui,manager-script"/>
2 webapps/manager/META-INF/context.xml
去掉註釋
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
不然會報錯
===================
或着修改容許訪問ip地址 allow="192.168.*.*" />
===================
四 配置dev,test環境配置文件
參考 https://blog.csdn.net/huangchao064/article/details/73616320
1 在你的項目代碼 ,配置開發,測試文件
resources\env\dev\*.properties
resources\env\test\*.properties
2 pom.xml增長 profiles
<profiles>
<profile>
<!-- 開發驗證環境 -->
<id>dev</id>
<properties>
<env>dev</env>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources/env/${env}</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<!-- 測試環境 -->
<id>test</id>
<properties>
<env>test</env>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources/env/${env}</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</profile>
</profiles>
3 pom.xml 增長
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes>WEB-INF/classes/env/**</packagingExcludes>
</configuration>
</plugin>
</plugins>
4 打包命令
這些配置完成後,就能夠打包了。打包命令以下
clean -Ptest package
5 jenkins配置
clean install -Ptest
=============
配置權限
若是須要分權限(安裝Role-based Authorization Strategy插件)
1 安全配置==>受權策略=選擇 Role-Based Strategy
2 系統管理 >> Manage and Assign Roles >>
3 Global roles 添加一個roles {zhihe只有Read,build}權限
Project roles 添加一個role(Test-zhihe) Pattern(Test-zh.*) {只有Read}權限
4 給用戶配角色 Assign Roles
===============================================
jenkins 遠程執行shell腳本問題
(緣由: 遠程服務器是ubuntun
http://www.lidaren.com/archives/1713
解決辦法:
在SSH的配置文件
/etc/ssh/sshd_config
增長如下兩行,讓SSH支持相應的算法和MACs
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com,hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96 |
完成後重啓SSH便可解決問題