Skip to content

Commit eeaae40

Browse files
authored
Merge pull request #360 from jamebal/develop
fix: 修复打包后无法读取office文档的问题
2 parents 858a326 + 1cfb7cd commit eeaae40

File tree

5 files changed

+2163
-516
lines changed

5 files changed

+2163
-516
lines changed

.github/workflows/test-native-build.yml

Lines changed: 75 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -107,78 +107,82 @@ jobs:
107107
- name: Check Maven version
108108
run: mvn -v
109109

110-
# 构建带插桩的 Native Image
111-
- name: Build Instrumented Native Image
110+
# # 构建带插桩的 Native Image
111+
# - name: Build Instrumented Native Image
112+
# run: |
113+
# mvn clean package -Pnative -Daot.build.mode=${{ inputs.aot_build_mode }} -DskipTests -Dnative-image.jvmArgs="-Xmx32g" -Dnative-image.addArgs="--pgo-instrument -o target/jmalcloud-instrumented"
114+
#
115+
# # 运行插桩程序以生成 Profile 文件
116+
# - name: Run Instrumented App to Generate Profile
117+
# env:
118+
# MONGODB_URI: ${{ secrets.MONGODB_URI }}
119+
# HOME_DIR: ${{ env.HOME }}
120+
# run: |
121+
# chmod +x target/jmalcloud-instrumented
122+
#
123+
# rm -rf ${HOME}/jmalcloud
124+
# rm -f jmalcloud.iprof
125+
#
126+
# mkdir -p ${HOME}/jmalcloud
127+
#
128+
# echo "Starting instrumented application in the background..."
129+
# # 在后台运行程序,并将 profile 文件名指定为 jmalcloud.iprof
130+
# # 使用 & 将其放入后台
131+
# ./target/jmalcloud-instrumented --spring.profiles.active=${{ inputs.profiles_active }} -XX:ProfilesDumpFile='jmalcloud.iprof' --spring.data.mongodb.uri=${{secrets.MONGODB_URI}} --file.rootDir=${HOME}/jmalcloud > "${HOME}/app.log" 2>&1 &
132+
#
133+
# # 获取后台进程的 PID (Process ID)
134+
# APP_PID=$!
135+
# echo "应用程序已启动,进程ID为: $APP_PID"
136+
#
137+
# # 等待应用启动
138+
# for i in {1..30}; do
139+
# if curl -s http://localhost:8088/public/health | grep -q '^UP'; then
140+
# echo "App is up"
141+
# break
142+
# fi
143+
# sleep 2
144+
# done
145+
#
146+
# # 创建管理员
147+
# curl --location --request POST 'http://localhost:8088/api/public/initialization?password=123456&id=&username=admin&showName=%E7%AE%A1%E7%90%86%E5%91%981&avatar=https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif&slogan=&introduction=&webpDisabled=&roles=&quota=10'
148+
# # 上传文件
149+
# cp -r target/test-classes ${HOME}/jmalcloud/admin/
150+
#
151+
# # 等待应用程序运行一段时间以收集性能数据
152+
# echo "等待应用程序运行 120 秒以收集性能数据..."
153+
# sleep 120
154+
#
155+
# # 打印日志文件的最后 100 行
156+
# tail -n 100 "${HOME}/app.log"
157+
#
158+
# echo "发送 SIGINT 信号来优雅地终止进程,这会触发 profile 文件的写入"
159+
# kill -15 $APP_PID
160+
#
161+
# echo "等待几秒钟,让进程优雅地终止..."
162+
# sleep 5
163+
#
164+
# ls -lh 'jmalcloud.iprof'
165+
#
166+
# ls -lh 'jmalcloud.iprof'
167+
#
168+
# # 验证 Profile 文件是否已创建
169+
# - name: Verify Profile File Creation
170+
# run: |
171+
# echo "Checking if profile file was created..."
172+
# ls -l jmalcloud.iprof
173+
# if [ ! -f "jmalcloud.iprof" ]; then
174+
# echo "Error: Profile file jmalcloud.iprof was not created."
175+
# exit 1
176+
# fi
177+
178+
# # 使用传入参数构建最终优化的 Native Image
179+
# - name: Build final PGO-Optimized Native Image
180+
# run: |
181+
# mvn clean package -Pnative -Daot.build.mode=${{ inputs.aot_build_mode }} -DskipTests -Dnative-image.jvmArgs="-Xmx15g" -Dnative-image.addArgs="--enable-monitoring=heapdump --pgo=jmalcloud.iprof"
182+
183+
- name: Build Native Image
112184
run: |
113-
mvn clean package -Pnative -Daot.build.mode=${{ inputs.aot_build_mode }} -DskipTests -Dnative-image.jvmArgs="-Xmx23g" -Dnative-image.addArgs="--pgo-instrument -o target/jmalcloud-instrumented"
114-
115-
# 运行插桩程序以生成 Profile 文件
116-
- name: Run Instrumented App to Generate Profile
117-
env:
118-
MONGODB_URI: ${{ secrets.MONGODB_URI }}
119-
HOME_DIR: ${{ env.HOME }}
120-
run: |
121-
chmod +x target/jmalcloud-instrumented
122-
123-
rm -rf ${HOME}/jmalcloud
124-
rm -f jmalcloud.iprof
125-
126-
mkdir -p ${HOME}/jmalcloud
127-
128-
echo "Starting instrumented application in the background..."
129-
# 在后台运行程序,并将 profile 文件名指定为 jmalcloud.iprof
130-
# 使用 & 将其放入后台
131-
./target/jmalcloud-instrumented --spring.profiles.active=${{ inputs.profiles_active }} -XX:ProfilesDumpFile='jmalcloud.iprof' --spring.data.mongodb.uri=${{secrets.MONGODB_URI}} --file.rootDir=${HOME}/jmalcloud > "${HOME}/app.log" 2>&1 &
132-
133-
# 获取后台进程的 PID (Process ID)
134-
APP_PID=$!
135-
echo "应用程序已启动,进程ID为: $APP_PID"
136-
137-
# 等待应用启动
138-
for i in {1..30}; do
139-
if curl -s http://localhost:8088/public/health | grep -q '^UP'; then
140-
echo "App is up"
141-
break
142-
fi
143-
sleep 2
144-
done
145-
146-
# 创建管理员
147-
curl --location --request POST 'http://localhost:8088/api/public/initialization?password=123456&id=&username=admin&showName=%E7%AE%A1%E7%90%86%E5%91%981&avatar=https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif&slogan=&introduction=&webpDisabled=&roles=&quota=10'
148-
# 上传文件
149-
cp -r target/test-classes ${HOME}/jmalcloud/admin/
150-
151-
# 等待应用程序运行一段时间以收集性能数据
152-
echo "等待应用程序运行 120 秒以收集性能数据..."
153-
sleep 120
154-
155-
# 打印日志文件的最后 100 行
156-
tail -n 100 "${HOME}/app.log"
157-
158-
echo "发送 SIGINT 信号来优雅地终止进程,这会触发 profile 文件的写入"
159-
kill -15 $APP_PID
160-
161-
echo "等待几秒钟,让进程优雅地终止..."
162-
sleep 5
163-
164-
ls -lh 'jmalcloud.iprof'
165-
166-
ls -lh 'jmalcloud.iprof'
167-
168-
# 验证 Profile 文件是否已创建
169-
- name: Verify Profile File Creation
170-
run: |
171-
echo "Checking if profile file was created..."
172-
ls -l jmalcloud.iprof
173-
if [ ! -f "jmalcloud.iprof" ]; then
174-
echo "Error: Profile file jmalcloud.iprof was not created."
175-
exit 1
176-
fi
177-
178-
# 使用传入参数构建最终优化的 Native Image
179-
- name: Build final PGO-Optimized Native Image
180-
run: |
181-
mvn clean package -Pnative -Daot.build.mode=${{ inputs.aot_build_mode }} -DskipTests -Dnative-image.jvmArgs="-Xmx15g" -Dnative-image.addArgs="--enable-monitoring=heapdump --pgo=jmalcloud.iprof"
185+
mvn clean package -Pnative -Daot.build.mode=${{ inputs.aot_build_mode }} -DskipTests
182186
183187
# 保存构建产物到本地共享目录
184188
- name: Save build artifacts to local cache

pom.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,17 +304,17 @@
304304
<dependency>
305305
<groupId>org.apache.poi</groupId>
306306
<artifactId>poi</artifactId>
307-
<version>5.4.1</version>
307+
<version>5.5.1</version>
308308
</dependency>
309309
<dependency>
310310
<groupId>org.apache.poi</groupId>
311311
<artifactId>poi-ooxml</artifactId>
312-
<version>5.4.1</version>
312+
<version>5.5.1</version>
313313
</dependency>
314314
<dependency>
315315
<groupId>org.apache.poi</groupId>
316316
<artifactId>poi-scratchpad</artifactId>
317-
<version>5.4.1</version>
317+
<version>5.5.1</version>
318318
</dependency>
319319
<dependency>
320320
<groupId>commons-io</groupId>
@@ -491,6 +491,7 @@
491491
<plugin>
492492
<groupId>org.graalvm.buildtools</groupId>
493493
<artifactId>native-maven-plugin</artifactId>
494+
<version>0.11.3</version>
494495
<configuration>
495496
<metadataRepository>
496497
<enabled>true</enabled>
@@ -528,7 +529,8 @@
528529
<buildArg>-H:+UnlockExperimentalVMOptions</buildArg>
529530
<buildArg>-H:+AddAllCharsets</buildArg>
530531
<buildArg>-H:+AllowIncompleteClasspath</buildArg>
531-
<buildArg>-H:IncludeResources=org/apache/poi/schemas/ooxml/system/ooxml/.*</buildArg>
532+
<buildArg>-H:-ReduceImplicitExceptionStackTraceInformation</buildArg>
533+
<buildArg>--initialize-at-run-time=org.apache.xmlbeans.XmlBeans</buildArg>
532534
<buildArg>-H:ExcludeResources=META-INF/services/org.hibernate.bytecode.spi.BytecodeProvider</buildArg>
533535
<buildArg>--enable-native-access=ALL-UNNAMED</buildArg>
534536
<buildArg>--enable-http</buildArg>

0 commit comments

Comments
 (0)