Eclipse SpringTestSuite 4/Spring Boot 2 Maven 如何在 运行 测试时排除 class 执行?
Eclipse SpringTestSuite 4/Spring Boot 2 Maven How do I exclude class execution when running tests?
我有一个 Eclipse SpringToolSuite 4.M12 IDE 运行ning Spring Boot 2 Web 应用程序。我有一个 class 用于在 运行 应用程序时为数据库播种。当我使用 运行 As/Maven 测试对 JUnit5 运行 进行测试时,我想阻止 运行ning 中的 class。我虽然可以使用与测试配置一起使用的配置文件名称来执行此操作,并使用 @Profile("!test") 之类的东西排除 class。不幸的是,我不知道如何在 pom 文件中指定配置文件名称。
有没有办法完成这种事情?
找到一种方法,添加,
<configuration>
<argLine>-Dspring.profiles.active=test</argLine>
</configuration>
到 maven-surefire-plugin
我有一个 Eclipse SpringToolSuite 4.M12 IDE 运行ning Spring Boot 2 Web 应用程序。我有一个 class 用于在 运行 应用程序时为数据库播种。当我使用 运行 As/Maven 测试对 JUnit5 运行 进行测试时,我想阻止 运行ning 中的 class。我虽然可以使用与测试配置一起使用的配置文件名称来执行此操作,并使用 @Profile("!test") 之类的东西排除 class。不幸的是,我不知道如何在 pom 文件中指定配置文件名称。
有没有办法完成这种事情?
找到一种方法,添加,
<configuration>
<argLine>-Dspring.profiles.active=test</argLine>
</configuration>
到 maven-surefire-plugin