今天写项目的时候发现点了Tomcat的run之后运行不起来,为什么呢?
第一种情况,配置了Tomcat,但是就是运行不起来,跑一下就停了
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<port>8080</port>
</configuration>
</plugin>
也没有任何报错,但是我跟别的能运行的tomcat的输出台对比了一下,发现多了一行输出:Skipping non-war project
解决办法:在pom.xml中加入
<packaging>war</packaging>
就可以正常运行了
第二种情况:导入别人的maven工程,想运行组件tomcat,但是压根不运行,直接弹窗罢工
Error running 'springmvc01 [org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run]':
No valid Maven installation found. Either set the home directory in the
configuration dialog or set the M2_HOME environment variable on your system.
解决办法:打开设置,把Maven_home path改成自己的地址即可