IDEA如果是社区版不支持web项目,也就是说没法添加tomcat/jetty这种服务器。
如果你是maven项目(gradle类似),在项目里添加一个maven的tomcat插件,其实就能运行web项目了。
-
pom.xml
文件里添加:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<!-- 通过maven tomcat7:run运行项目时,访问项目的端口号 -->
<port>8080</port>
<!-- 项目访问路径 本例:localhost:9090, 如果配置的aa, 则访问路径为localhost:9090/aa-->
<path>/mall</path>
</configuration>
</plugin>
这里使用的是tomcat7-maven-plugin
版本是2.2,也可以使用其他的。
-
运行项目
image.png
-
调试项目
如果想断点调试怎么办呢?

从配置里创建也是同理的




使用Jetty插件同理。
网友评论