代码之家  ›  专栏  ›  技术社区  ›  newbie

如何使用apachemaven部署build-to-server?

  •  2
  • newbie  · 技术社区  · 16 年前

    3 回复  |  直到 16 年前
        1
  •  2
  •   Pascal Thivent    16 年前

    Tomcat Maven Plugin 以及 Maven2 Cargo Plugin 支持远程Tomcat部署(假设manager应用程序可用)。

    对于tomcatmaven插件,请参阅 Usage 页面,配置非常简单。

    <build>
      <plugins>
        <plugin>
          <groupId>org.codehaus.cargo</groupId>
          <artifactId>cargo-maven2-plugin</artifactId>
          <version>1.0.1-sr-1</version>
          <configuration>
            <wait>true</wait>
            <container>
              <containerId>tomcat6x</containerId>
              <type>remote</type>
            </container>
            <configuration>
              <type>runtime</type> 
              <properties>
                <cargo.tomcat.manager.url>[https://yourhost/manager]</cargo.tomcat.manager.url>
                <cargo.remote.username>[username]</cargo.remote.username>
                <cargo.remote.password>[password]</cargo.remote.password>
              </properties>
            </configuration>
            <deployer>
              <type>remote</type>
              <deployables>
                <deployable>
                  <groupId>[war group id]</groupId>
                  <artifactId>[war artifact id]</artifactId>
                  <type>war</type>
                  <properties>
                    <context>[optional root context]</context>
                  </properties>
                  <pingURL>[optional url to ping to know if deployable is done or not]</pingURL>
                  <pingTimeout>[optional timeout to ping (default 20000 milliseconds)]</pingTimeout>
                </deployable>
              </deployables>
            </deployer>
          </configuration>
        </plugin>
      </plugins>
    </build>
    

    mvn cargo:deploy .

    货物更强大(因为集装箱不可知),但也更复杂。对于简单的需求,我发现Maven Tomcat插件非常简单。

        2
  •  1
  •   Péter Török    16 年前
        3
  •  0
  •   Pascal Thivent    16 年前

    antrun 任务的插件。

    对于其他部署,请查看 cargo plugin

    推荐文章