jenkins+git+maven构建项目遇到的问题
jenkins+git+maven构建项目遇到的问题
一 git代理
在启动jenkins配置好git之后,启动项目,报了无法拉取git项目的问题,最后定位是git需要取消代理,命令如下
git config --global --unset http.proxy
git config --global --unset https.proxy
二 配置git的ssh
在设置数据源时有两种方式,一种是通过账号密码,一种是通过ssh。账号密码的方式,经过测试,会偶发性发生无法拉取git项目的情况,只能采取ssh的方式。配置ssh需要注意的是,jenkins启动项目时,使用的用户是jenkins,所以生成秘钥时,需要切换成jenkins用户来生成。还有注意配置在jenkins上面的凭证输入的是私钥,配置在github上面的是公钥。
ssh-keygen -t rsa -C "邮箱"
三 项目的maven版本
构建时报错,判断为项目配置的maven-resources-plugin插件比服务器上面的高,解决办法只要设置项目pom文件的插件版本就可以了
22:04:12 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project spring-data-security-demo: The plugin org.apache.maven.plugins:maven-resources-plugin:3.2.0 requires Maven version 3.1.0 -> [Help 1]
22:04:12 [ERROR]
22:04:12 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
22:04:12 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
22:04:12 [ERROR]
22:04:12 [ERROR] For more information about the errors and possible solutions, please read the following articles:

浙公网安备 33010602011771号