问题
今天 mvn
启动应用报错
spring application did not start before the configured timeout 30000ms
苦思良久,肯定是插件启动超时,应该有配置的,但是没找到
最后在 stackoverfllow 上看到大神说
You are trying to start a spring boot app before in pre-integration-test phase. The spring-boot-maven-plugin StartMojo class (org.springframework.boot.maven) is complaining because the app is not started within the default timeout, wich is defined by the attributes "wait" (defautl value: 500 ms) and "maxAttempts" (default: 60) -> 500 * 60.
/**
* The number of milli-seconds to wait between each attempt to check if the spring
* application is ready.
*/
@Parameter
private long wait = 500;
/**
* The maximum number of attempts to check if the spring application is ready.
* Combined with the "wait" argument, this gives a global timeout value (30 sec by
* default)
*/
@Parameter
private int maxAttempts = 60;
"wait" and "maxAttempts" are annotated @Parameter, which means you can change their value from within your pom file, in the plugin configuration like this:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<wait>1000</wait>
<maxAttempts>180</maxAttempts>
</configuration>
<executions>
...
</executions>
</plugin>
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于