在Windows上,Ctrl C无法停止由Maven启动Java进程的原因
发布时间:2020-12-14 02:18:14 所属栏目:Windows 来源:网络整理
导读:我创建了一个可执行的Tomcat jar应用程序,可以由Maven运行(mvn clean install exec:exec).可以通过 Linux上的Ctrl C停止此应用程序.但是,它无法在Windows上运行.有谁知道原因和解决方案? 环境: $mvn -versionApache Maven 3.2.2 (45f7c06d68e745d05611f7f
我创建了一个可执行的Tomcat jar应用程序,可以由Maven运行(mvn clean install exec:exec).可以通过
Linux上的Ctrl C停止此应用程序.但是,它无法在Windows上运行.有谁知道原因和解决方案?
环境: $mvn -version Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T22:51:42+09:00) Maven home: c:apache-maven-3.2.2 Java version: 1.8.0_121,vendor: Oracle Corporation Java home: c:Program FilesJavajdk1.8.0_121jre Default locale: ja_JP,platform encoding: MS932 OS name: "windows 7",version: "6.1",arch: "amd64",family: "dos" pom.xml的摘录: <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <executions> <execution> <id>tomcat-run</id> <goals> <goal>exec-war-only</goal> </goals> <phase>package</phase> <configuration> <path>/</path> <enableNaming>true</enableNaming> <finalName>embtest.jar</finalName> <charset>utf-8</charset> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> <warName>ROOT</warName> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <executions> <execution> <id>startup-uber-tomcat</id> <phase>install</phase> <goals> <goal>exec</goal> </goals> <configuration> <classpathScope>test</classpathScope> <executable>java</executable> <arguments> <argument>-jar</argument> <argument>target/embtest.jar</argument> </arguments> </configuration> </execution> </executions> </plugin> 重现步骤: (1)在Windows上运行命令: $git clone https://github.com/k-tamura/embtest.git $cd embtest $mvn clean install exec:exec (2)访问http://localhost:8080 – >显示主页面. (3)按Ctrl C. (4)访问http://localhost:8080 – >主页面仍然显示(Tomcat未停止). 解决方法
要停止所有工作:
mvn tomcat7:shutdown 当使用组合键Ctrl C时,仍然有一些工作. 参考: http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/plugin-info.html http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/shutdown-mojo.html (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读