yxh
昨天 fce96ef468291fb9a0e6a4d34ab371315e9485d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>cn.lihu</groupId>
        <artifactId>jh</artifactId>
        <version>${revision}</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
 
    <artifactId>jh-server</artifactId>
    <packaging>jar</packaging>
 
    <name>${project.artifactId}</name>
    <description>
        后端 Server 的主项目,通过引入需要 jh-module-xxx 的依赖,
        从而实现提供 RESTful API 给 jh-ui-admin、jh-ui-user 等前端项目。
        本质上来说,它就是个空壳(容器)!
    </description>
    <url>https://github.com/YunaiV/ruoyi-vue-pro</url>
 
    <dependencies>
        <dependency>
            <groupId>cn.lihu</groupId>
            <artifactId>jh-module-system-biz</artifactId>
            <version>${revision}</version>
        </dependency>
        <dependency>
            <groupId>cn.lihu</groupId>
            <artifactId>jh-module-infra-biz</artifactId>
            <version>${revision}</version>
        </dependency>
 
        <!-- ECG中心。默认注释,保证编译速度 -->
        <dependency>
            <groupId>cn.lihu</groupId>
            <artifactId>jh-module-ecg-biz</artifactId>
            <version>${revision}</version>
        </dependency>
 
        <!-- 会员中心。默认注释,保证编译速度 -->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-member-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
 
        <!-- 数据报表。默认注释,保证编译速度 -->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-report-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
        <!-- 工作流。默认注释,保证编译速度 -->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-bpm-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
        <!-- 支付服务。默认注释,保证编译速度 -->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-pay-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
 
        <!-- 微信公众号模块。默认注释,保证编译速度 -->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-mp-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
 
        <!-- 商城相关模块。默认注释,保证编译速度-->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-promotion-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-product-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-trade-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-statistics-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
 
        <!-- CRM 相关模块。默认注释,保证编译速度 -->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-crm-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
 
        <!-- ERP 相关模块。默认注释,保证编译速度 -->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-erp-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
 
        <!-- AI 大模型相关模块。默认注释,保证编译速度 -->
<!--        <dependency>-->
<!--            <groupId>cn.lihu</groupId>-->
<!--            <artifactId>jh-module-ai-biz</artifactId>-->
<!--            <version>${revision}</version>-->
<!--        </dependency>-->
 
        <!-- spring boot 配置所需依赖 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
 
        <!-- 服务保障相关 -->
        <dependency>
            <groupId>cn.lihu</groupId>
            <artifactId>jh-spring-boot-starter-protection</artifactId>
        </dependency>
 
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
            <version>${openfeign.version}</version>
        </dependency>
 
<!--
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
-->
 
    </dependencies>
 
    <build>
        <!-- 设置构建的 jar 包名 -->
        <finalName>${project.artifactId}</finalName>
 
        <!--
            合并部署:把 ecg_web 的前端构建产物打进 jar。
 
            · 目标目录选 META-INF/resources/frontend 而非 static:
              META-INF/resources 是 Servlet 3.0 标准静态资源目录,Spring Boot
              默认会扫描;额外加一层 frontend/ 前缀,便于后端用
              addResourceHandlers 精确控制"哪些 URL 交给前端",
              不影响后端已有的 /doc.html、/druid/**、/profile/** 等路径。
              见 cn.lihu.jh.server.ecg.FrontendResourceConfig。
 
            · 产物目录由 profile 注入的 env.VITE_OUT_DIR 决定,
              默认 dist-merged(对应 ecg_web 的 `pnpm build:merged`)。
 
            · 注意:本模块【不】引入 frontend-maven-plugin。
              前端构建请在部署前单独执行(cd ecg_web && pnpm build:merged),
              避免后端构建强依赖 node/pnpm,也避免构建机需要外网下载 node。
        -->
        <resources>
            <!-- 保留原有的后端资源(application*.yaml、logback-spring.xml 等) -->
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
            <!-- 新增:前端产物 -->
            <resource>
                <directory>${project.basedir}/../../ecg_web/${env.VITE_OUT_DIR}</directory>
                <targetPath>META-INF/resources/frontend</targetPath>
                <filtering>false</filtering>
            </resource>
        </resources>
 
        <plugins>
            <!-- 打包 -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring.boot.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
 
    <!--
        前端产物目录的选择。env.VITE_OUT_DIR 会被上面 <resources> 引用。
 
        · frontend-merged(默认):使用 ecg_web 执行 `pnpm build:merged` 产出的
          dist-merged,对应"前端打进 jar、与后端同源"的合并部署模式。
        · frontend-prod:回退到原有的 dist-prod。若前端仍由 nginx 独立托管
          (即不做合并部署),用 -P frontend-prod 激活此 profile 即可,
          此时 jar 内不含前端,行为与改造前一致。
    -->
    <profiles>
        <profile>
            <id>frontend-merged</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <env.VITE_OUT_DIR>dist-merged</env.VITE_OUT_DIR>
            </properties>
        </profile>
        <profile>
            <id>frontend-prod</id>
            <properties>
                <env.VITE_OUT_DIR>dist-prod</env.VITE_OUT_DIR>
            </properties>
        </profile>
    </profiles>
 
</project>