zoukankan      html  css  js  c++  java
  • Maven

    This article will explain on how to deploy a war fine in to Tomcat 7 through maven build.

    Note : I have tested same settings for Tomcat 8 as well. So below settings can be apply for both versions.

    Configure tomcat7-maven-plugin in pom.xml

        <!-- Tomcat plugin -->  
                <plugin>  
                     <groupId>org.apache.tomcat.maven</groupId>  
                     <artifactId>tomcat7-maven-plugin</artifactId>  
                     <version>2.2</version>  
                     <configuration>  
                     <!-- finalName:defaults to ${artifactId}-${version} -->
                      <path>/beepay</path>  
                      <update>true</update>  
                      <url>http://localhost:8080/manager/text</url>
                      <server>Tomcat</server>  
                      <username>tomcat</username>  
                      <password>tomcatuser</password>  
                     </configuration>  
                </plugin> 

    Configure user rights in the tomcat-user.xml which is in the tomcat conf file.

    <role rolename="tomcat" />  
    <role rolename="manager-gui" />  
    <role rolename="manager-script" />  
    <role rolename="admin-gui" />  
    <user username="tomcat" password="tomcatuser"  
     roles="tomcat,manager-gui,admin-gui,manager-script" /> 

    Adding server to Maven settings.xml file: Next step is to add a server in maven settings.xml file, as shown below.

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <servers>
          <server>
            <id>Tomcat</id>
            <username>tomcat</username>
            <password>tomcatuser</password>
          </server>
    </servers>
    </settings>

    overwrite the tomcat-users.xml to eclipse server folder :Project Explorer > 'Server's > Tomcat v7.0 Server at localhost-config > tomcat-users.xml

    change  default deployment  path to:

    add a mvn goal:

     

  • 相关阅读:
    初识现代软件工程——构建之法
    个人作业3——个人总结(Alpha阶段)
    结对编程2
    个人作业2——英语学习APP案例分析
    结对作业1
    java四则运算
    个人附加作业
    个人作业3——个人总结(Alpha阶段)
    结对编程2——单元测试
    个人作业2——英语学习APP案例分析
  • 原文地址:https://www.cnblogs.com/sos-blue/p/4803992.html
Copyright © 2011-2022 走看看