zoukankan      html  css  js  c++  java
  • maven发布本地包,eclipse-maven集成tomcat7热部署项目

    国内maven 库 :http://maven.aliyun.com/nexus/content/groups/public/

    maven安装不在中央仓库的jar包:
      mvn install:install-file -Dfile=${path}XXX-XXX.jar -DgroupId=XXX.XXX.XXX  -DartifactId=XXXX -Dversion=${version} -Dpackaging=jar
    example(例子):
      D:>mvn install:install-file -Dfile=c:myTestjar-2.3.jar -DgroupId=com.google.code  -DartifactId=kaptcha -Dversion=2.3 -Dpackaging=jar

    Maven Tomcat插件现在主要有两个版本,tomcat-maven-plugin和tomcat7-maven-plugin,使用方式基本相同,请往下看。

    注意:首先要  配置tomcat的管理用户以及权限。

      打开tomcat-users.xml文件在后面加入 

        <role rolename="manager-gui"/>

        <role rolename="manager-script"/>

        <user password="123456" roles="manager-gui,manager-script" username="admin"/>

    tomcat7-maven-plugin 使用

    配置

    两个插件使用方法基本一样,同样需要在pom.xml引用该插件,需要增加以下配置

    <build>
      <finalName>myproject</finalName>
        <plugins>
          <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
              <url>http://192.168.159.128/manager/text</url>
              <path>/</path>
              <server>tomcat</server>
              <username>admin</username>
              <password>123456</password>
            </configuration>
        </plugin>
      </plugins>
    </build>

    插件使用 

    简要说明一下:

    path  是访问应用的路径

    port 是tomcat 的端口号

    uriEncoding  URL按UTF-8进行编码,这样就解决了中文参数乱码。

    Server 指定tomcat名称。

    配置就这么简单,基本搞掂,下面看看如何使用。

    插件运行

    如果Eclipse 安装了Maven插件,选 择项目,击右键——>选择 Run As——> Maven build 。

    image

    如果是第一次运行,会弹出下面对话框。在Goals框加加入以下命令: tomcat:run

    image

    这样Tomcat 插件就可以运行。

    下面介绍几个常用的Goal

    命令 描述
    tomcat:deploy 部署一个web war包
    tomcat:reload 重新加载web war包

    tomcat:start

    启动tomcat

    tomcat:stop

    停止tomcat

    tomcat:undeploy

    停止一个war包
    tomcat:run 启动嵌入式tomcat ,并运行当前项目

    在这里要注意一下,该插件命名方式有些不同,比如启动tomcat ,对应的目标命令是: tomcat7:run ,其他都需要更改为:tomcat7,

    配置就这么简单,如果需要在 tomcat 跟踪联调,可以用Dubug 方式启动maven命令。

  • 相关阅读:
    防删没什么意思啊,直接写废你~
    绝大多数情况下,没有解决不了的问题,只有因为平时缺少练习而惧怕问题的复杂度,畏惧的心理让我们选择避让,采取并不那么好的方案去解决问题
    Java 模拟面试题
    Crossthread operation not valid: Control 'progressBar1' accessed from a thread other than the thread it was created on
    一步步从数据库备份恢复SharePoint Portal Server 2003
    【转】理解 JavaScript 闭包
    Just For Fun
    The database schema is too old to perform this operation in this SharePoint cluster. Please upgrade the database and...
    Hello World!
    使用filter筛选刚体碰撞
  • 原文地址:https://www.cnblogs.com/pghWord/p/5552625.html
Copyright © 2011-2022 走看看