Java、SpringBoot、gradle 上的集成测试以从构建中排除

integration tests on Java, SpringBoot, gradle to exclude from build

如何根据外部属性在 Spring 引导测试 gradle 上排除集成测试?

尝试使用@ActiveProfiles。但是没有用

这是我找到的解决方案。

您可以根据外部系统属性将其排除。

-Dtest.profile=integration

并在 build.gradle

test {
    if (System.properties['test.profile'] != 'integration') {
    exclude '**/*integrationTests*'
   }
}