zoukankan      html  css  js  c++  java
  • maven 发布 到 远程 tomcat

    需要修改3个地方 

    首先 maven setting.xml 在 servers 节点 中 添加 一个 server  

      <server>
               <id>devTomcat</id>  
               <username>admin</username>
               <password>admin123</password>
           </server>

    然后 在 tomcat 中 添加 一个用户  tomcat-users.xml

    <role rolename="manager-gui"/>
    <role rolename="manager"/>
    <role rolename="admin"/>
    <role rolename="manager-script"/>
    <role rolename="manager-jmx"/>
    <role rolename="manager-status"/>
    <user username="admin" password="admin123" roles="admin,manager,manager-gui,manager-script,manager-jmx,manager-status"/>

    最后 使用 maven    tomcat7-maven-plugin 插件 

            <plugins>
                <plugin>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-maven-plugin</artifactId>
                    <version>9.4.6.v20170531</version>
                    <configuration>
                        <httpConnector>
                            <port>8090</port>
                        </httpConnector>
                        <stopPort>9966</stopPort>
                        <stopKey>foo</stopKey>
                        <scanIntervalSeconds>2</scanIntervalSeconds>
                        <webApp>
                            <!-- web项目根路径 -->
                            <contextPath>/</contextPath>
                        </webApp>
                    </configuration>
                </plugin>
    
          <!-- 这里就是发布插件 --> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <url>http://127.0.0.1:8080/manager/text</url> <server>devTomcat</server> <path>/</path> <charset>utf-8</charset> </configuration> </plugin> </plugins> </build>

    首次发布  tomcat7:deploy

    重新发布 tomcat7:redeploy

    可能配置了 tomcat用户 依然显示403 这是因为tomcat 默认只允许 本机 提交 。如果需要允许远程更改 webapps manager中 META-INF 中

    context.xml ,将 allow 换成 你起得的ip 就可以。

  • 相关阅读:
    bootstrap学习笔记之基础导航条 http://www.imooc.com/code/3111
    bootstrap学习笔记之导航条基础
    Bootstrap学习笔记之文本对齐风格
    leetcode------Find Peak Element
    leetcode------Search a 2D Matrix
    leetcode------Set Matrix Zeroes
    【python】enumerate函数
    leetcode------Gray Code
    leetcode------Letter Combinations of a Phone Number
    leetcode------Best Time to Buy and Sell Stock II
  • 原文地址:https://www.cnblogs.com/whm-blog/p/7238991.html
Copyright © 2011-2022 走看看