Using the run mojo from the cargo-maven2-plugin I would like to know of a better way to shut down the container.
The console output says Ctrl+C to stop, but that seems to do nothing.
If I terminate, it leaves an orphan java.exe process that I have to kill myself.
Am I doing something wrong? This is a little cumbersome.
Edit: I am usign Tomcat in a standalone config. If I use embedded Jetty, naturally terminate works, however we need Tomcat.
The CTRL+C thing seems to be a known Eclipse/Jetty issue. The last post says that issuing mvn cargo:stop
would stop an already running container, however it doesn't work for me—albeit, I've only made some quick test a with an archetype generated webapp.
Using Eclipse Indigo Service Release 1 (20110916-0149) if I issue mvn cargo:run
and wait for the container to boot (for now it's Jetty, no configurations; let's see if you can get it working like this) clicking on the big red Terminate button kills the running process and no lingering java{,w}.exe
are left behind.
I don't know how do you issue mvn cargo:run
from Eclipse right now, but maybe you're using it as an External Tool (and that's why a process is left behind). If you have m2eclipse installed you should create Maven run configurations for it like this:
Run --> Run Configurations --> Maven build --> right click --> New
It should be straightforward from here on.
(I've found two Eclipse bug tickets (here and here) that seems to be related to Eclipse's inability to read a healthy CTRL+C via it's console.)
I've verified that when I'm starting an external Tomcat (7.0.23) instance with mvn cargo:run
from Eclipse via the m2e plugin (after the container have started) CTRL+C indeed doesn't work.
After this I've ran mvn cargo:run
from my Cygwin console. The result was the same.
Finally I've tried it from Windows's cmd and it worked.
My guess is that this is a bug in the cargo-maven-plugin
.
Running mvn cargo:stop
from either Eclipse or Cygwin did the trick for me.
You can run the cargo plugin from Eclipse by creating a Maven build
Run or Debug configuration in Eclipse.