-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Maven-failsafe-plugin fails to execute integration tests #6254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@JIIMI thank you so much for the sample, very helpful. |
That does not make much sense to me. If I paste the code snippet above, it doesn't invoke the failsafe plugin at all (there's no execution). If I put the definition of the failsafe plugin that is provided as of 1.4 in If I remove the Maybe related this this SO thread? |
@snicoll I'm glad it helped.
With the following stack trace:
|
OK that's definitely interesting. It does not find your main spring boot class (which it definitely should). |
For the:
You're actually right, the maven-failsafe-plugin isn't invoked. I updated the project with the following configuration: <plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> Now the plugin gets invoked and the integration tests are properly run under version 1.3.5.RELEASE. |
This problem is due to a combination of a change in the Failsafe plugin and a change in the layout of a repackaged jar file in Boot 1.4. As of Failsafe 2.19, |
A workaround is to configure a classifier for the repackaged jar. This allows Failsafe to use the original jar: <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin> |
Another workaround is to downgrade to the |
Both indeed works. I guess keeping the 2.19.1 version should be better than using the old version. @snicoll @wilkinsona Thank you both for your help. |
Unfortunately, the out-of-the-box experience would be very bad with Thanks for the report! |
This should be documented in the release notes. |
@andrashatvani what should be? If you're using the plugin management we provide, everything will work as advertized. So you'll have that issue only if you start overriding things. The release notes is a place to warn users about something we've actually changed. We didn't (the issue was introduced in a 1.4 milestone and fixed in RC). |
Sure, but I don't use the plugin management and I bet it's optional for a good reason i.e. we're not the only developers facing this issue. Just put the information in the release notes that one of the two workarounds is necessary if one upgrades to 1.4 and doesn't use the Spring Boot parent. |
You're right, thanks for not letting that go. I've added a section in the release notes. |
Thanks! |
Would the fixed failsafe version 2.19.2 work with spring-boot 1.4.x out of the box or is there something else than just dependency update coming to 1.5.x? |
@sepanniemi It should work out the box. |
I faced the same issue while using spring boot 1.3.3.RELEASE, spring 4.2.5.RELEASE with maven-failsafe-plugin 2.19.1, and this post helped me to find a solution for he same. Edit:
|
@deepakab03 It hasn't been released yet |
okay, thanks! |
The Currently I'm using:
Is there a roadmap to get failsafe working out of the box without the |
Following a trail of clues, I found an alternative workaround is to restore the behavior in 2.19+ of using http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#classesDirectory So I removed the
This allowed both |
#23) * Added goal 'repackage' to spring-boot-maven-plugin definition, see OBST-273. * Workaround for spring-projects/spring-boot#6254
I found workaround for using both a renamed spring boot uber jar and boxfuse together. |
As an alternative to use
This is more in line with failsafe's of testing the packaged jar file instead of the classes |
Refactor connectors 3rd party to use constructor injection instead of field inject and use strategy pattern to select the call strategy (with or without SLA). Had to downgrade failsafe version due to spring-projects/spring-boot#6254
Is there a particular reason why I still need to add this for Spring Boot 2.0 RC1? execITs fail without it and failsafe plugin. |
Same here. Which is nowadays the correct way to make Spring Boot (now 2.0) work with the Failsafe plugin? Any example project? |
This issue is closed and we don't use the tracker for questions: please ask on StackOverflow or join us on Gitter. If you believe you've found an issue with the way the failsafe plugin is configured, please raise a separate issue with a sample that reproduces the problem. |
Thanks for try to help people out, @mmuller88, but JUnit 5 is compatible with Maven. The JUnit team maintain a Maven-based sample. Spring Boot also has its own JUnit 5 sample that uses Maven. |
See also https://stackoverflow.com/q/42082131/32453 but...this feels unresolved somehow, should a new issue be raised with failsafe perhaps? (FWIW 2.18.1 worked better for me than 2.19.1) |
Essentially, newer versions test against the JAR, whereas until v2.18.1 failsafe uses test-class. Somehow the JAR creates problems when resources such as the attributes.yml are needed. See also: * https://stackoverflow.com/questions/42082131/maven-surefire-verify-java-lang-classnotfoundexception * spring-projects/spring-boot#6254
Essentially, newer versions test against the JAR, whereas until v2.18.1 failsafe uses test-class. Somehow the JAR creates problems when resources such as the attributes.yml are needed. See also: * https://stackoverflow.com/questions/42082131/maven-surefire-verify-java-lang-classnotfoundexception * spring-projects/spring-boot#6254
Take a look at this question https://stackoverflow.com/q/49363222/1429387 |
I just added the
|
adding surefire dependency works for me, dont know exactly why though
|
Using Failsafe plugin without parent spring-boot dependency and having a custom directory build path I got this working with the next code:
|
works for me too |
As of March 2024 this is still up to date. |
When using the maven-filesafe-plugin the integration-test goal fails during build.
The following error happens under snapshot and 1.4.0.M3 versions. The same configuration is working fine under 1.3.5.RELEASE version.
Plugins are configured in the following way:
I created a minimal project available here:
https://github.com/JIIMI/Spring-Boot-Maven-Failsafe-Plugin-Issue
The text was updated successfully, but these errors were encountered: