[TOC] ## 项目构建 在ocp根路径下进行package,有如下几个包会被自动构建。 ``` [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] open-capacity-platform [pom] [INFO] inner-intergration [pom] [INFO] db-spring-boot-starter [jar] [INFO] redis-spring-boot-starter [jar] [INFO] common-spring-boot-starter [jar] [INFO] log-spring-boot-starter [jar] [INFO] swagger-spring-boot-starter [jar] [INFO] uaa-client-spring-boot-starter [jar] [INFO] uaa-server-spring-boot-starter [jar] [INFO] rabbitmq-spring-boot-starter [jar] [INFO] ribbon-spring-boot-starter [jar] [INFO] sentinel-spring-boot-starter [jar] [INFO] register-center [pom] [INFO] oauth-center [pom] [INFO] auth-server [jar] [INFO] api-gateway [jar] [INFO] business-center [pom] [INFO] user-center [jar] [INFO] file-center [jar] [INFO] generator-center [jar] [INFO] sms-center [jar] [INFO] workflow-center [jar] [INFO] job-center [pom] [INFO] job-core [jar] [INFO] job-admin [jar] [INFO] job-demo [jar] [INFO] monitor-center [pom] [INFO] admin-server [jar] [INFO] log-center [jar] [INFO] transaction-center [jar] [INFO] sentinel-dashboard [jar] [INFO] zipkin-center [pom] [INFO] zipkin-center-es [pom] [INFO] es-client [jar] [INFO] fescar-center [pom] [INFO] fescar-api [jar] [INFO] fescar-order [jar] [INFO] fescar-user [jar] [INFO] fescar-item [jar] [INFO] report-center [jar] [INFO] new-api-gateway [jar] [INFO] web-portal [pom] [INFO] back-center [jar] [INFO] [INFO] --------------< com.open.capacity:open-capacity-platform >-------------- ``` ## 二、如何把ocp中的业务项目独立成为Springboot项目? 我在基于evm框架的条件下,把一个业务项目(zentao-center)集成到了ocp中。这是一个禅道的扩展系统,用来以甘特图的方式展现或定义禅道任务。因为子涵先生在前端这块比较初级,因此准备采用ocp中已有的前端模型进行开发。 有**三点**需要注意: 第一,`pom.xml`把nacos相关配置去掉: ```xml <!-- 选用nacos时打开--> <!-- <dependency>--> <!-- <groupId>com.alibaba.cloud</groupId>--> <!-- <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>--> <!-- </dependency>--> <!-- <dependency>--> <!-- <groupId>com.alibaba.cloud</groupId>--> <!-- <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>--> <!-- </dependency>--> ``` 第二,启动类中的`@EnableDiscoveryClient`注释掉: ```java //@EnableDiscoveryClient @SpringBootApplication @MapperScan("com.open.capacity.zentao.dao") public class ZenTaoApp { public static void main(String[] args) { // 固定端口 // SpringApplication.run(FileCenterApp.class, args); // 随机端口启动 SpringApplication app = new SpringApplication(ZenTaoApp.class); app.addListeners(new PortApplicationEnvironmentPreparedEventListener()); app.run(args); } } ``` 第三,删除resources下面`bootstrap.yml`配置文件。 ## 如何把Springboot项目集成到ocp中作为一个业务项目? 相反,如果把一个Springboot项目集成到ocp中,我们需要做什么呢?倒序补充上文中去掉的配置文件就好了。 除了以上三点,还应注意以下几点。 ### 网关添加路由 Zuul网关: ~~~ zentao: path: /api-zentao/** service-id: zentao-center strip-prefix: true ~~~ APIGateWay网关: ~~~ - id: api-zentao uri: lb://zentao-center order: 8003 predicates: - Path=/api-zentao/** filters: - StripPrefix=1 ~~~ ### 前端配置 在`back-center`的静态文件文件夹`static.pages`下添加zentao\taskView.html。 ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> 子涵来了 </body> </html> ``` ### 配置菜单、角色权限 ![](https://img.kancloud.cn/87/5b/875bb571e67557612722f7858360fa4f_1860x612.png)