Reputation: 11
When I am running my Spring boot Application via Eclipse I am able to execute my cucumber test(Main.run(requestParamter, contextClassLoader)) case but when I am running via Spring boot Jar I'm getting below exception.
Test cases could not execute successfully and exception is:
io.cucumber.core.exception.CucumberException: The resource
jar:file:/C:/386619/iplus-qeas-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/validation-api-2.0.1.Final.jar!/
is located in a nested jar.\n\nThis typically happens when trying to
run Cucumber inside a Spring Boot Executable Jar.\nCucumber currently
doesn't support classpath scanning in nested jars.\nFeel free to send
a pull request to make this possible!\n\nYou can avoid this error by
unpacking your application before executing.
Upvotes: 1
Views: 1060
Reputation: 12019
You are running Cucumber from inside an executable jar file. This means that if you open the jar file you'll see something like this:
https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-executable-jar-format.html
example.jar
|
+-META-INF
| +-MANIFEST.MF
+-org
| +-springframework
| +-boot
| +-loader
| +-<spring boot loader classes>
+-BOOT-INF
+-classes
| +-mycompany
| +-project
| +-YourClasses.class
+-lib
+-dependency1.jar
+-dependency2.jar
Right now cucumber is scanning the entire class path for glue and feature files. This includes your dependencies in BOOT-INF/lib
. However Cucumber can't open these. Cucumber can however read the contents of BOOT-INF/classes
because that is mostly like a normal jar file.
So try passing --glue mycompany.project --features:classpath:mycompany/project
. This way Cucumber will only scan the contents ofBOOT-INF/classes
.
Upvotes: 1