2019独角兽企业重金招聘Python工程师标准>>>
转自 https://www.cnblogs.com/hdwang/p/6081994.html
==============================
安装插件:
1 maven插件 2 tomcat自动部署插件 Deploy to container Plugin
一 创建maven 项目
二 添加帐号
获取代码 1svn帐号 2 tomcat部署帐号
Credentials->system->点击
Global credentials (unrestricted) |
Add Credentials
填入UserName: deploy
password:deploy
三 配置tomcat部署
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.*.*" />
===================
Jenkins发布报错:403/401 for URL: http://192.168.64.100:8080/manager/text/list
四 配置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脚本问题
JSch连接SSH问题Exception:Algorithm negotiation fail
(原因: 远程服务器是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-sha1MACs 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即可解决问题