Description
I have a plugin which is injected with a Plexus Component. This plexus component implements the plexus Startable interface, and therefore expects stop() to be called upon completion in order to perform cleanup. In addition, the component is a singleton-keep-alive component so it sticks around for a while and is available to other plugins.
Now this plugin spawns and monitors a thread (it actually kicks off a copy of Jetty 5 so I can do integration tests). Naturally, I want to shut down Jetty 5 after my tests have run. To do this I have another plugin which is run after my integration tests which gets the component and tells it to shutdown the threads.
All works well so far, provided that the tests don't fail.
If the tests do fail, the stop plugin is never reached. In standalone maven this all works fine, because the process ends, killing the threads.
In embedded maven however, the stop method of the component is never called, so that my copy of Jetty keeps on running and I have to shutdown my entire embedded environment (in this case Netbeans with Mevenide, but I believe the same problem occurs in Eclipse).
Running through the code, it appears that Maven never shuts down the top level component, thus components never have the opportunity to cleanup.