I have the following project structure.
There is no src/main folder.
Above src/test/java folder contains some scala classes as well as some java classes. When i build the jar file using following plugins
Please suggest
how to generate the 'tests' jar with all the dependencies in it unpacked. OR How to generate jar file in this case with all the classes under src/test/java folder and all the dependencies required by the tests classes
Yep, code being under src/test/java
is typical for a Karate test. You can't put under src/test/main
unless you wired things up to run the tests , perhaps by hitting a spring boot controller to start them. Then, in your Docker container, you can start the tests from your runnning spring boot app. That is very non-standard and I wouldn't recommend doing that.
Instead, I would just start with a Maven docker image, and build your own image that knows how to copy the test files (un-jarred) into the image, THEN you wont need to .jar it all up. I made an example here (https://github.com/djangofan/karate-test-prime-example), complete with proper handling of the docker exit-code.
There is some documentation on the Karate site for making a standalone karate-jar but the documentation on the specifics of how to do that is sparse. I bet it works if you knew how to do it. Still, that is more difficult than the Docker example I give above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With