Skip to content

Fine框架

  • 为保证项目依赖的统一性和保证对于公共组件的使用,进行依赖管理。

父工程

  • 并在父工程中进行版本管理

子模块

  • 子模块的公共组件的依赖版本都是同一个版本
  • 子模块实现对应业务逻辑功能

项目

  • 在项目中感觉需要使用子模块依赖
  • 在项目中不在直接使用公共组件的依赖

创建父工程:fine-parent

  1. 创建名为fine-parent的maven父工程

创建父工程

  1. 删除父工程src文件夹

  2. 修改pom,并刷新maven

xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>cn.finemap</groupId>
  <artifactId>fine-parent</artifactId>
  <version>1.0-RELEASE</version>
  <packaging>pom</packaging>
  <name>fine-parent</name>

  <properties>
    <fine.version>1.0-RELEASE</fine.version>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    <java.version>17</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <modules>
  </modules>
</project>
  1. 添加.gitignore
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### 授权 ###
/src/main/resources/fine-parent.lic

### VS Code ###
.vscode/

创建子模块:fine-xxx

  • 在fine-parent中创建:fine-xxx

fine-xxx

  • 创建子模块:New > Module...

  • 添加公共组件的依赖

配置文件设置

  • 子模块:resources/application-xxx.yml
yaml
fine:
  show: true # 打印授权过程信息,默认:true 
  open: true # 启动完成打不打开网页,默认:true 
  http: http://127.0.0.1/ # 启动完成打开的网页链接,默认:本地ip:server.port
  port: 80 # 启动完成打开的网页端口,默认:creator的端口,可以修改为nginx的端口
  • 项目:resources/application.yml
yaml
spring:
  profiles:
    include: xxx,其他