源码打包准备
以全源码打包为例,部分源码打包请自行修改配置。
- 源代码;
build打包工具目录
build目录在源码根目录下。
执行打包
win+r
打开cmd命令界面。进入源码更目录。
进入build构建目录。
执行
ant
命令打包。如图
不用选择,直接按回车
Enter
下一步不用选择,直接按回车
Enter
下一步不用选择,直接按回车
Enter
下一步输入
deploy
,按回车Enter
下一步install
表示本地发布安装,deploy
表示发布到远程私服。不用选择,直接按回车
Enter
下一步开始打包,会持续一段时间…耐心等待
打包完成
查看打包日志是否出现异常
文件名ant.log
上述结果表明发布成功
获取程序包
- eureka程序包,目录ibps-basis-root\modules\basis-eureka\target\ibps-basis-eureka-exclude。
- gateway程序包,目录ibps-basis-root\modules\basis-gateway\target\ibps-basis-gateway-exclude。
- oauth2server程序包,目录ibps-oauth-root\modules\oauth-server2\target\ibps-oauth-server2-exclude。
- platform程序包,目录ibps-provider-root\modules\provider-platform\target\ibps-provider-platform-exclude。
- business程序包,目录ibps-provider-root\modules\provider-business\target\ibps-provider-business-exclude。
注册中心使用eureka还是consul或是zookeeper,在打包阶段已经决定,如需修改必须打包时修改依赖。
默认注册中心为consul。
附录
注册中心修改为eureka
修改依赖,修改ibps-basic-root\modules\basic-discovery。
修改前:<!-- <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-discovery</artifactId> </dependency> <!-- <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-zookeeper-discovery</artifactId> <exclusions> <exclusion> <groupId>org.apache.curator</groupId> <artifactId>curator-x-discovery</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-x-discovery</artifactId> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-client</artifactId> </dependency> -->
修改后:
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <!-- <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-discovery</artifactId> </dependency> --> <!-- <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-zookeeper-discovery</artifactId> <exclusions> <exclusion> <groupId>org.apache.curator</groupId> <artifactId>curator-x-discovery</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-x-discovery</artifactId> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-client</artifactId> </dependency> -->
修改配置文件引入
修改项目ibps-basis-root\modules\basis-gateway
修改项目ibps-oauth-root\modules\oauth-server2
修改项目ibps-provider-root\modules\provider-platform
修改项目ibps-provider-root\modules\provider-business
以ibps-basis-root\modules\basis-gateway项目为例:
修改src\main\resources\application-dev.yml
修改前:spring: profiles: include: dev-base,dev-gw-base,dev-consul
修改后:
spring: profiles: include: dev-base,dev-gw-base,dev-eureka
修改src\main\resources\application-test.yml
修改前:spring: profiles: include: test-base,test-gw-base,test-consul
修改后:
spring: profiles: include: test-base,test-gw-base,test-eureka
修改src\main\resources\application-prod.yml
修改前:spring: profiles: include: prod-base,prod-gw-base,prod-consul
修改后:
spring: profiles: include: prod-base,prod-gw-base,prod-eureka