Skip to content

Commit a0d6b1b

Browse files
committed
修复前端打包和环境变量配置问题
- 添加 frontend-maven-plugin 自动构建前端 - 添加资源复制插件将前端打包到 JAR - 修复环境变量名称(APP_DOMAIN) - 配置 GitHub Actions 自动同步环境变量
1 parent 6d96bca commit a0d6b1b

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

pom.xml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,75 @@
150150

151151
<build>
152152
<plugins>
153+
<!-- 前端构建插件 -->
154+
<plugin>
155+
<groupId>com.github.eirslett</groupId>
156+
<artifactId>frontend-maven-plugin</artifactId>
157+
<version>1.15.0</version>
158+
<configuration>
159+
<workingDirectory>web</workingDirectory>
160+
<installDirectory>target</installDirectory>
161+
</configuration>
162+
<executions>
163+
<!-- 安装 Node.js 和 npm -->
164+
<execution>
165+
<id>install node and npm</id>
166+
<goals>
167+
<goal>install-node-and-npm</goal>
168+
</goals>
169+
<configuration>
170+
<nodeVersion>v18.20.5</nodeVersion>
171+
<npmVersion>10.8.2</npmVersion>
172+
</configuration>
173+
</execution>
174+
<!-- 安装前端依赖 -->
175+
<execution>
176+
<id>npm install</id>
177+
<goals>
178+
<goal>npm</goal>
179+
</goals>
180+
<configuration>
181+
<arguments>ci</arguments>
182+
</configuration>
183+
</execution>
184+
<!-- 构建前端 -->
185+
<execution>
186+
<id>npm run build</id>
187+
<goals>
188+
<goal>npm</goal>
189+
</goals>
190+
<configuration>
191+
<arguments>run build</arguments>
192+
</configuration>
193+
</execution>
194+
</executions>
195+
</plugin>
196+
197+
<!-- 资源复制插件 -->
198+
<plugin>
199+
<groupId>org.apache.maven.plugins</groupId>
200+
<artifactId>maven-resources-plugin</artifactId>
201+
<version>3.3.1</version>
202+
<executions>
203+
<execution>
204+
<id>copy-frontend-build</id>
205+
<phase>prepare-package</phase>
206+
<goals>
207+
<goal>copy-resources</goal>
208+
</goals>
209+
<configuration>
210+
<outputDirectory>${project.build.directory}/classes/static</outputDirectory>
211+
<resources>
212+
<resource>
213+
<directory>web/dist</directory>
214+
<filtering>false</filtering>
215+
</resource>
216+
</resources>
217+
</configuration>
218+
</execution>
219+
</executions>
220+
</plugin>
221+
153222
<plugin>
154223
<groupId>org.springframework.boot</groupId>
155224
<artifactId>spring-boot-maven-plugin</artifactId>

0 commit comments

Comments
 (0)