【问题标题】:Cargo Maven on Remote Server远程服务器上的货物 Maven
【发布时间】:2018-02-23 05:46:24
【问题描述】:

我正在尝试使用 cargo maven 插件在远程服务器上运行战争,但我得到: [ERROR] 无法在项目portnet 上执行目标org.codehaus.cargo:cargo-maven2-plugin:1.6.4:start (start-container):只能启动本地容器-> [帮助1]强>

我的配置如下:

          <plugin>
             <groupId>org.codehaus.cargo</groupId>
             <artifactId>cargo-maven2-plugin</artifactId>
             <version>1.6.4</version>
             <configuration>
             <wait>false</wait>
               <container>
                  <containerId>tomcat8x</containerId>
                  <type>remote</type>                 
               </container>

               <configuration>
                  <type>runtime</type>
                     <files>
                        <copy>
                           <file>C:\apache-tomcat-8.5.20\conf\tomcat-users.xml</file>
                           <tofile>conf/tomcat-users.xml</tofile>
                           <configfile>true</configfile>
                           <overwrite>true</overwrite>
                        </copy>
                     </files>
                     <properties>
                        <cargo.hostname>remoteserver</cargo.hostname>
                        <cargo.servlet.port>8180</cargo.servlet.port>
                        <cargo.remote.username>user</cargo.remote.username>
                        <cargo.remote.password>passw</cargo.remote.password>                           <cargo.tomcat.manager.url>http://localhost:8180/manager</cargo.tomcat.manager.url>
                </properties>
                </configuration>

            <deployer>
                <type>remote</type>                 
            </deployer>

            <deployables>
                <deployable>
                   <type>war</type>
                   <properties>
                          <context>/portnet</context>
                    </properties>    
            </deployable>
            </deployables>

        </configuration>

            <executions>
              <!-- start server before integration tests -->
              <execution>
                <id>start-container</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <!-- stop server after integration tests -->
              <execution>
                <id>stop-container</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
    </plugins>

【问题讨论】:

    标签: tomcat cargo-maven2-plugin


    【解决方案1】:

    如果您想使用远程服务器,那么您可以使用以下两个 Cargo 目标:

    • deploy - 此目标用于将定义的可部署项部署到远程服务器。
    • undeploy - 此目标用于从远程服务器取消部署已定义的部署。

    目标startstop 只能用于本地容器 - 其生命周期由 Cargo Maven 插件直接控制的容器。

    如果您将配置中的&lt;goal&gt;start&lt;/goal&gt; 替换为&lt;goal&gt;deploy&lt;/goal&gt; 并将&lt;goal&gt;stop&lt;/goal&gt; 替换为&lt;goal&gt;undeploy&lt;/goal&gt;,那么您应该消除此错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-29
      • 1970-01-01
      • 2020-01-29
      • 1970-01-01
      • 1970-01-01
      • 2015-04-10
      • 2016-09-13
      • 2015-10-07
      相关资源
      最近更新 更多