在pom.xml文件中加入如下插件代码,即可直接使用tomcat和jetty,不用安装实体。
- tomcat插件
<!--tomcat的maven插件-->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<port>8080</port>
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>
- jetty插件
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.29.v20200521</version>
<configuration>
<httpConnector>
<port>8080</port>
<host>localhost</host>
</httpConnector>
</configuration>
</plugin>
运行命令:tomcat7:run和jetty:run
网友评论