zoukankan      html  css  js  c++  java
  • 在Idea中通过Tomcat运行maven项目

    转:

    在Idea中通过Tomcat运行maven项目

    1.在Idea中通过Tomcat的Maven插件运行项目
    (1)Tomcat 7的配置(推荐,下载速度较快)

    在pom.xml中加入下面红色字体部分的配置:

        <build>
          <finalName>项目名称</finalName>
          <pluginManagement>
         
        省略…
          </pluginManagement>
          <plugins>
                <plugin>
                  <groupId>org.apache.tomcat.maven</groupId>
                  <artifactId>tomcat7-maven-plugin</artifactId>
                  <version>2.2</version>
                  <configuration>
                      <port>8000</port>
                      <path>/test</path>
                      <uriEncoding>UTF-8</uriEncoding>
                      <server>tomcat7</server>
                  </configuration>
               </plugin>
           </plugins>
        </build>

    (2)Tomcat 8的配置(不推荐,非官方仓库,下载速度很慢)

    在pom.xml中加入下面红色字体部分的配置:

        <pluginRepositories>
        <pluginRepository>
            <id>alfresco-public</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
        </pluginRepository>
        <pluginRepository>
            <id>alfresco-public-snapshots</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>beardedgeeks-releases</id>
            <url>http://beardedgeeks.googlecode.com/svn/repository/releases</url>
        </pluginRepository>
        </pluginRepositories>
         
        <build>
          <finalName>项目名称</finalName>
          <pluginManagement>
         
        省略…
         
          </pluginManagement>
         
          <plugins>
         
                <plugin>
         
                  <groupId>org.apache.tomcat.maven</groupId>
         
                  <artifactId>tomcat8-maven-plugin</artifactId>
         
                  <version>3.0-r1655215</version>
         
                  <configuration>
         
                      <port>8000</port>
         
                      <path>/test</path>
         
                      <uriEncoding>UTF-8</uriEncoding>
         
                      <server>tomcat7</server>
         
                  </configuration>
         
               </plugin>
         
           </plugins>
         
        </build>

    (3)检查配置是否成功

    (4)运行项目

    出现以下提示信息:

    [INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ MavenSpringHelloWorld

    [INFO] Running war on http://localhost:8000/test

    [INFO] Using existing Tomcat server configuration at E:IdeaWorkSpaceMavenSpringHelloWorld arget omcat

    [INFO] create webapp with contextPath: /test

     

    在浏览器中输入url,即可成功运行。

    2.在Idea中使用外置的Tomcat运行项目
    (1)通过Run->Edit Configurations…进入配置界面

     

     

     


    (2)在Tomcat Server中的Local配置Tomcat

    然后再点OK,就配好了。
    ————————————————
    版权声明:本文为CSDN博主「zc15779595171」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/zc15779595171/java/article/details/83098052

  • 相关阅读:
    如何在百度网盘中批量添加好友,批量创建群组,导出群链接等
    批量对百度网盘好友及群组发文字消息及分享文件
    百度网盘禁止查看别人分享主页的资源收集解决办法
    C#调用windows API实现 smallpdf客户端程序进行批量压缩
    邓西百度网盘目录导出工具
    .net sqlite 内存溢出 问题的分析与解决。
    移动呼死你防护业务白名单批量导入工具
    如何拦截电话轰炸、短信轰炸
    以技术原理入手从根本上拦截屏蔽解决响一声电话呼死你炸你妹电话轰炸短信轰炸,远离电话短信骚扰
    邓西百度网盘批量分享工具
  • 原文地址:https://www.cnblogs.com/libin6505/p/13255745.html
Copyright © 2011-2022 走看看