0

To run my Maven application in Windows, I start the Cargo container with this command:

C:\code\myapp> mvn -P cargo.run

Then I use Ctrl-C to stop the Cargo container.

I want to do the same thing in Eclipse. I've created a run configuration for Maven:

enter image description here

This allows me to start the Cargo container, which I can view in the the Ecipse console:

enter image description here

At this point, Ctrl-C does nothing. I read here that Ctrl-C doesn't work inside Eclipse, but that I can stop the container with mvn cargo:stop. As you can see in the screenshot, I'm trying to use this command but it doesn't do anything. There's also a Maven console in Eclipse, but this command doesn't do anything there either:

enter image description here

If I use the Terminate button in the console window (red square), it leaves an orphaned JRE instance that I have to stop manually, and the container is still running.

Is there another window where I should be trying to use this command? Is there a better way to start and stop the container in Eclipse?

Community
  • 1
  • 1
Big McLargeHuge
  • 14,841
  • 10
  • 80
  • 108

1 Answers1

1

There is some information missing in your question, like your pom configuration that would help a lot to provide you the best answer possible.

The solution that will work for sure is to create a new run configuration for Maven on your project, as you did to launch your container with cargo, but instead of using the profile that you created to launch cargo, use the goal cargo:stop and then run this configuration.

It will launch the command mvn cargo:stop in another shell and will stop the container. And then you will be able to stop the console of the execution that launched cargo without having the orphaned JRE running.

A few years ago (about 8...) I tried to find a better solution when I worked a lot with cargo but could not improved this way to do it.

Fabien
  • 859
  • 6
  • 15