目的:   解决免费版本Intellij Idea中没有tomcat的烦恼


No1.  创建或导入一个maven项目,必须包含pom.xml文件


No.2 在pom.xml中引入tomcat7插件,具体示例代码如下:

<project>

<build>

<plugins>

            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <port>9090</port>
                    <path>/</path>
                    <uriEncoding>UTF-8</uriEncoding>
                    <server>tomcat7</server>
                </configuration>
            </plugin>

        </plugins>
    </build>
</project>


No.3	配置run tomcat

1. 点击Run  在弹出小框中选择 Edit Configurations

如何在Intellij Idea中的项目使用tomcat插件如何在Intellij Idea中的项目使用tomcat插件


2.  在Configurations窗口中的左上角 点击  + 号 ,再选择maven选项 ,然后就可以在右边配置tomcat run的信息,需要配置的有:Name = 项目名    command line = tomcat7:run     Working directory = 项目的路径  , 配置完成后,点击右下角的Apply,然后点击OK完成

如何在Intellij Idea中的项目使用tomcat插件

如何在Intellij Idea中的项目使用tomcat插件


No.4 配置完成后,在绿色三角形run的旁边的下拉框里就有刚刚配置的项目名称了,上面No.3配置的项目名称是cms,所以这里是cms,选择cms,然后点击绿色三角形执行Run就可以了

如何在Intellij Idea中的项目使用tomcat插件

如何在Intellij Idea中的项目使用tomcat插件

No.5 项目成功启动,通过localhost:9090/   就可以访问项目了






















相关文章:

  • 2021-11-23
  • 2021-11-05
  • 2022-12-23
  • 2022-01-04
  • 2022-01-11
  • 2021-05-29
  • 2022-12-23
猜你喜欢
  • 2021-08-26
  • 2022-12-23
  • 2021-08-06
  • 2021-10-20
相关资源
相似解决方案