当我运行服务器生命周期的install
命令时,我收到以下错误:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.507 s
[INFO] Finished at: 2017-03-10T15:32:41+01:00
[INFO] Final Memory: 69M/596M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:start (pre-integration-test) on project challenger-server-boot: Spring application did not start before the configured timeout (30000ms -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
它显然来自超时设置,但我无法找到我必须更改此值...
不确定它是否有帮助,但这里有一些与单元和集成测试相关的pom.xml:
<!-- Unit testing -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- Integration testing -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
这是调试日志:http://pastebin.com/kUkufHFS
答案 0 :(得分:6)
您正在尝试在预集成测试阶段之前启动Spring启动应用程序。 spring-boot-maven-plugin StartMojo类(org.springframework.boot.maven)正在抱怨,因为应用程序未在默认超时内启动,由“wait”属性定义(defautl值:500 ms)和“ maxAttempts“(默认值:60) - &gt; 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”和“maxAttempts”都带有@Parameter注释,这意味着您可以在pom文件中更改它们的值,在插件配置中如下:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<wait>1000</wait>
<maxAttempts>180</maxAttempts>
</configuration>
<executions>
...
</executions>
</plugin>