简体   繁体   中英

Maven - How to tell Maven to run integration tests with application-integration.properties under src/test/resources?

small question regarding Maven and how to run integration test, but with a different default path for the profile properties file.

Currently, integration tests phase runs fine in the application-integration.properties found under src/main/resources.

   <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>

   

I just want to tell Maven, "hey, don't look at the default localtion under src/main/resources, I moved it under src/test/resources, please read it from there".

How to configure this please?

Thank you

You can set in the configuration section profile to "integration" by adding

<profiles><profile>integration</profile></profiles>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM