问题描述
我想使用一个来自cargo-maven2-plugin的运行mojo,来找到一种关闭容器的更好方法.
Using the run mojo from the cargo-maven2-plugin I would like to know of a better way to shut down the container.
控制台输出显示Ctrl + C停止,但这似乎无济于事.
The console output says Ctrl+C to stop, but that seems to do nothing.
如果我终止,它将留下我必须杀死自己的孤立的java.exe进程.
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.
我在独立配置中使用Tomcat.如果我使用嵌入式Jetty,自然可以终止工作,但是我们需要Tomcat.
I am usign Tomcat in a standalone config. If I use embedded Jetty, naturally terminate works, however we need Tomcat.
推荐答案
+ 似乎是已知的 Eclipse/Jetty问题.上一篇文章说,发出mvn cargo:stop
会停止一个已经运行的容器,但是对我来说不起作用-尽管我只对使用原型生成的webapp进行了一些快速测试.
The + 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.
如果我发布mvn cargo:run
并等待容器启动,请使用 Eclipse Indigo Service Release 1(20110916-0149)(现在是Jetty,没有配置;让我们看看是否可以得到它)这样工作)点击大红色 Terminate 按钮会终止正在运行的进程,并且不会留下任何挥之不去的java{,w}.exe
.
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.
我现在不知道如何从Eclipse发行mvn cargo:run
,但是也许您将其用作外部工具(这就是为什么留下了流程).如果安装了m2eclipse,则应按以下步骤为其创建Maven运行配置:
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.
我已经验证了,当我通过m2e插件从Eclipse使用mvn cargo:run
从Eclipse启动外部Tomcat(7.0.23)实例时(在容器启动之后) + 确实不起作用.
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) + indeed doesn't work.
此后,我从Cygwin控制台运行了mvn cargo:run
.结果是一样的.
After this I've ran mvn cargo:run
from my Cygwin console. The result was the same.
最后,我已经在Windows的 cmd 中进行了尝试,并且可以正常工作.
Finally I've tried it from Windows's cmd and it worked.
我的猜测是这是cargo-maven-plugin
中的错误.
My guess is that this is a bug in the cargo-maven-plugin
.
在Eclipse或Cygwin上运行mvn cargo:stop
对我来说都是成功的秘诀.
Running mvn cargo:stop
from either Eclipse or Cygwin did the trick for me.
您可以通过在Eclipse中创建Maven build
运行或调试配置来从Eclipse运行cargo插件.
You can run the cargo plugin from Eclipse by creating a Maven build
Run or Debug configuration in Eclipse.
这篇关于如何干净地阻止M2E货物:从Eclipse运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!