I've have some java code that starts a web server and listens for requests. I'd like to start the web server from a custom maven plugin goal.
This works fine (starts my web server and listens for requests):
public static void main(String[] args) {
MyWebServer webserver = new MyWebServer();
webserver.startServer();
}
I'd like to put this inside a custom maven plugin:
/**
*
* @goal start
*
*/
public class MyMojo
extends AbstractMojo
{
public void execute()
throws MojoExecutionException
{
(new MyWebServer()).startServer();
}
}
It almost works, except that Maven doesn't stop to let the web server respond to requests. It calls startServer and then appears to stops it and immediately continues on with other tasks.
Anyone know how to tell maven to wait/block until it receives CTRL-C from command line? I'd like it to behave similar to the way the jetty maven plugin works.
Thanks, Dave