jenkins+git+springboot+maven持续集成构建部署

本文详细介绍了如何使用Jenkins、Git、SpringBoot和Maven进行持续集成和构建部署。首先,讲解了Jenkins的安装和配置,包括安装插件如Maven Integration、Docker等。接着,设置了Jenkins的Docker server REST API URL和Maven配置。然后,创建了一个Maven项目,配置了源码管理、构建触发器、构建步骤和Post Steps。最后,测试了构建流程,展示了从提交代码到自动构建、部署的全过程。
摘要由CSDN通过智能技术生成

本文参考自: 原文地址

一、安装jenkins

参考 https://store.docker.com/images/jenkins 进行安装

docker cp 容器id:容器内文件 宿主主机目录 可以拷贝那个key出来(jenkins容器里没有vi 安装vi比较麻烦不如拷贝文件出来方便)

二、安装插件

1.Maven Integration plugin

2.docker-build-step

3.Git plugin 、Git client plugin、 GIT server Plugin

三、jenkins设置

1.设置:Docker server REST API URL

系统管理->系统设置 找到 Docker Builder 

我的系统是centos7 

1.vim /usr/lib/systemd/system/docker.service 

2.直接在ExecStart=/usr/bin/dockerd 后添加 -H=0.0.0.0:6732 -H=unix:///var/run/docker.sock   

3.执行如下两个命令

systemctl daemon-reload 

systemctl restart docker

jenkins和springboot项目部署在在同一个主机上,我用的ip是私有IP,这样docker 生成镜像时要快些

2.设置Maven

系统管理->Global Tool Configuration 

四、新建项目

1.新建一个maven项目

2.源码管理

3.构建触发器

我的是gitlab 上面那个地址填在:你那git服务器的web hooks上,当代码提交到git上jenkins就会开始build

4.设置Build

5.设置Post Steps

6.保存

五、测试

点击 立即构建

或者提交新的git


点击上面#65 查看Console Output

  1. BeanPostProcessors (for example: not eligible for auto-proxying)
  2. . ____ _ __ _ _
  3. /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
  4. ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
  5. \\/ ___)| |_)| | | | | || (_| | ) ) ) )
  6. ' |____| .__|_| |_|_| |_\__, | / / / /
  7. =========|_|==============|___/=/_/_/_/
  8. :: Spring Boot :: (v1.5.2.RELEASE)
  9. 2017-08-16 10:06:02.758 INFO 6589 --- [ main] com.dcssn.WeianApplicationTests : No active profile set, falling back to default profiles: default
  10. 2017-08-16 10:06:02.762 INFO 6589 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Refreshing org.springframework.web.context.support.GenericWebApplicationContext@64711bf2: startup date [Wed Aug 16 10:06:02 UTC 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@f1da57d
  11. 2017-08-16 10:06:04.141 INFO 6589 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
  12. 2017-08-16 10:06:05.171 INFO 6589 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
  13. 2017-08-16 10:06:05.263 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.ProductRepository.
  14. 2017-08-16 10:06:05.265 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.DepartmentRepository.
  15. 2017-08-16 10:06:05.266 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.FlinkRepository.
  16. 2017-08-16 10:06:05.266 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.NewsRepository.
  17. 2017-08-16 10:06:05.267 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.TypeRepository.
  18. 2017-08-16 10:06:05.280 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.UserRepository.
  19. 2017-08-16 10:06:05.281 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.RoleRepository.
  20. 2017-08-16 10:06:05.412 WARN 6589 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
  21. 2017-08-16 10:06:05.854 INFO 6589 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=621c2cec-3059-3fd9-9e49-4656ed1a82ee
  22. 2017-08-16 10:06:06.152 INFO 6589 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'jpaConfiguration' of type [com.dcssn.config.JpaConfiguration$$EnhancerBySpringCGLIB$$62f44bbb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  23. 2017-08-16 10:06:06.357 INFO 6589 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$85f2e13b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  24. 2017-08-16 10:06:06.697 INFO 6589 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a20ce438] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  25. 2017-08-16 10:06:08.030 INFO 6589 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
  26. 2017-08-16 10:06:08.159 INFO 6589 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
  27. 2017-08-16 10:06:08.195 INFO 6589 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
  28. name: default
  29. ...]
  30. 2017-08-16 10:06:08.337 INFO 6589 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
  31. 2017-08-16 10:06:08.338 INFO 6589 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
  32. 2017-08-16 10:06:08.340 INFO 6589 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
  33. 2017-08-16 10:06:08.410 INFO 6589 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
  34. 2017-08-16 10:06:08.647 INFO 6589 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
  35. 2017-08-16 10:06:09.834 INFO 6589 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
  36. 2017-08-16 10:06:10.444 INFO 6589 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
  37. 2017-08-16 10:06:11.578 INFO 6589 --- [ main] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
  38. Hibernate: select role0_.id as id1_5_, role0_.name as name2_5_, role0_.url as url3_5_ from role role0_
  39. 2017-08-16 10:06:15.152 INFO 6589 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@4bf89d3d, org.springframework.se
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值