[英]Springboot - application-integration.properties working under src/main/resources, but not under src/test/resources
[英]Maven - How to tell Maven to run integration tests with application-integration.properties under src/test/resources?
关于 Maven 以及如何运行集成测试的小问题,但配置文件属性文件的默认路径不同。
目前,集成测试阶段在 src/main/resources 下的 application-integration.properties 中运行良好。
<profiles>
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<wait>1000</wait>
<maxAttempts>180</maxAttempts>
<jmxPort>${random.jmx.port}</jmxPort>
<jvmArguments>
-Dspring.application.admin.enabled=true
</jvmArguments>
</configuration>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
我只想告诉 Maven,“嘿,不要看 src/main/resources 下的默认位置,我把它移到了 src/test/resources 下,请从那里阅读”。
请问这个怎么配置?
谢谢
您可以通过添加在配置部分配置文件设置为“集成”
<profiles><profile>integration</profile></profiles>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.