How to close a Maven server after debugging

Thank you all for answering quickly and with clear explanations last time: Thanks to your help, I have now finished following that guide, and just now realized a new problem: I do not know how to shut down the Maven server when finished. Online search provide fairly limited result: Google search Stack Overflow search So is there a way to close a Maven server, or will it continue to take up a port (a small price to pay) until I restart the computer?

If you’ve started the server with the command mvn openmrs-sdk:run -DserverId=server in a terminal window then you should be able to terminate it by pressing Ctrl+C in the same terminal.

If that doesn’t work then you could also kill the Java process running your server. You could use ps a | grep openmrs-sdk:run to find out the process id (pid) and then use kill <pid>, for instance kill 4408.

Hope that helps :slight_smile:

1 Like

Thank you for your help. But isn’t Ctrl + C is just copy? I will try terminating the Java process, that ought to work.

Ctrl+C is not just for copying. :slight_smile: In a command-line environment, which I assume you are using, Ctrl+C will send an interrupt signal (SIGINT) to the program, which usually terminates it. It should be the easiest way of shutting down the Maven server so give it a try. In the screenshot below, on the last line you can see the ^C indicating I pressed Ctrl+C and then the server was shut down.

1 Like

Ctrl + Z will also Terminate stubborn processes.