Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven spring boot pre-integration-test timeout error

When I run the command install of my server's Lifecycle I get the following error:

[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

It obviously comes from the timeout settings but I cannot find where I have to change this value...

Not sure if it can help but here's some of my pom.xml related to the unit and integration 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>

Here's the debug log: http://pastebin.com/kUkufHFS

like image 719
Sébastien Avatar asked Mar 10 '17 15:03

Sébastien


1 Answers

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>
like image 70
F.doe Avatar answered Nov 01 '22 05:11

F.doe