• maven项目自动打包部署到tomcat中


    1. 在eclipse配置tomcat,部署路径设置为tomcat的webapps目录下。

    2.修改tomcat-users.xml

      <!-- Tomcat 6.x 系列-->

      <role rolename="manager"/> 

        <user password="admin" roles="manager" username="admin"/>

     <!-- Tomcat 7.x 系列-->

     <role rolename="manager"/> 

     <role rolename="manager-script"/>
     <role rolename="admin-gui"/>
     <role rolename="manager-gui"/>
     <user username="admin" password="pass!@#" roles="manager,manager-gui,admin-gui,manager-script"/>

    3.maven的settings.xml 文件打开,写入用户名和密码

    <servers>
    <server>
    <id>tomcat</id>
    <username>admin</username>
    <password>pass!@#</password>
    </server>
    </servers>

    4.pom文件为:

    <build>
            <finalName>dounine-frame</finalName>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat6-maven-plugin</artifactId>
                    <version>2.0</version>
                    <configuration>
                        <!-- Tomcat 6.x -->
                        <url>http://localhost:8080/manager/</url>
                         <!-- Tomcat 7.x -->
                         <!-- <url>http://localhost:8080/manager/text</url> -->
                  <server>tomcat</server> <!-- 这个server标签里面的值(tomcat)要和你的setting.xml里面的id的值(tomcat)一致-->
                        <username>admin</username>
                        <password>admin</password>
                        <path>/dounine-frame</path>
                    </configuration>
                </plugin>
            </plugins>
            <resources>
                <resource>
                    <directory>src/main/java</directory>
                    <includes>
                        <include>**/*.xml</include>
                    </includes>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>*.*</include>
                    </includes>
                </resource>
            </resources>
        </build>

    5.启动tomcat

    6.在eclipse中:tomcat6.x使用 tomcat6:redeploy。

  • 相关阅读:
    C#中的语言记忆功能
    C#中 文件的打开及保存
    无边框窗体设置
    Windows获取浏览器中存储的明文密码
    (CVE-2020-17530)Struts2 S2-061漏洞复现
    (CVE-2020-14882​&14883)Weblogic RCE复现
    内网渗透学习-信息收集篇
    Spring Boot Actuator H2 RCE复现
    Linux解压文件
    Windows本地提权
  • 原文地址:https://www.cnblogs.com/dapeng520/p/4638366.html
Copyright © 2020-2023  润新知