2017-03-10 110 views
2

當我跑我的服務器生命週期的命令install我收到以下錯誤:Maven的春季啓動預集成測試超時錯誤

[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有關單位和集成testings的:

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

這裏是得不g日誌:http://pastebin.com/kUkufHFS

+0

你可以重新運行你的Maven語句並添加-X來進行調試日誌以獲取更多信息嗎?謝謝 您可以將完整的調試日誌記錄粘貼到一些在線粘貼文本,粘貼bin,例如:http://pasted.co/ –

+0

爲什麼要嘗試定義已經屬於maven-surefire-plugin和maven-故障安全的插件。沒有必要爲maven-surefire-plugin排除'**/* IT.java',或者將它們包含在maven-failsafe-plugin中... – khmarbaise

+0

@LemLe:我將調試日誌添加到問題 – Papple

回答

2

您正試圖在預集成測試階段之前啓動Spring Boot應用程序。 Spring-boot-maven-plugin StartMojo類(org.springframework.boot.maven)抱怨,因爲該應用程序未在默認超時內啓動,由屬性「等待」(defautl值:500毫秒)定義,以及「maxAttempts」(默認值: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; 

「等待」和「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> 
+0

謝謝!有效! – Papple