I'm currently using the maven plugin exec-maven-plugin
to execute a script, this script launches several java programs corresponding to an integration test
, if the test passes, everything is stopped properly by a cleanup script
executed later in the build.
My problem is when the test fails because when the plugin exec-maven-plugin
fails it stops the build immediately such that my cleanup script
is never called which means that my java programs are never stopped.
So is there a way to execute my cleanup script
even if my integration test
fails?
So far, I added 1
as successCode
to my integration test to ensure that my cleanup script
is called but it is not good enough because the build is seen has a build success which is not the case.
Any ideas?
Here is what I finally did:
1
as success code
to my integration test
in order to make sure that the cleanup script
is always called.outputFile
to my integration test
in order to redirect the standard output streams into a file to be tested latercleanup script
, I check for a given pattern in file created in step #2 using a command of type cat {my-file} | grep {my-pattern} >/dev/null
in order to know if the integration test
passed or not, if the pattern cannot be found, it will make the build fails otherwise the build will pass.