You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SpringBoot AOP测试在Eclipse正常但Maven执行失败求助

Maven Surefire执行Spring AOP切面测试失败,但Eclipse中正常运行

我的项目jobkit模块中有4个验证@Aspect调用的测试无法通过,这些测试在最新版Eclipse中可正常运行,但在最新版Maven中执行失败。

复现步骤

git clone https://github.com/hdsdi3g/prodlib
git checkout issue51
mvn install -DskipTests && mvn test -rf :jobkit
# 或直接执行mvn test 

相关代码位置

  • 测试类:jobkit/springboot-service/src/test/java/tv/hd3g/jobkit/mod/component/SupervisableAspectTest.java 第70行
  • 切面类:jobkit/springboot-service/src/main/java/tv/hd3g/jobkit/mod/component/SupervisableAspect.java
  • 目标测试类:jobkit/springboot-service/src/test/java/tv/hd3g/jobkit/mod/component/TestWithSupervisable.java

错误信息

[ERROR] Failures:
[ERROR]   SupervisableAspectTest.testWithDefaultName:76
Wanted but not invoked:
getSupervisableSupplier bean.createAndStart(
    "TestWithSupervisable.aSupervisableMethod"
);
-> at tv.hd3g.jobkit.engine.SupervisableServiceSupplier.createAndStart(SupervisableServiceSupplier.java:31)
Actually, there were zero interactions with this mock.

相关配置文件

  • 主pom:pom.xml
  • 项目pom:jobkit/springboot-service/pom.xml
  • 依赖版本:jobkit/springboot-service/THIRD-PARTY.txt

所有测试在Eclipse中正常,但Maven Surefire测试失败,想确认是代码实现问题还是Maven配置问题?

内容的提问来源于stack exchange,提问作者hdsdi3g

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 21:55:21