2017-09-14 228 views
0

我正在尝试使用货物maven插件在远程服务器上运行一场战争,但我得到: [错误]未能执行目标org.codehaus.cargo:cargo-maven2-plugin: 1.6.4:启动(启动容器)项目PORTNET:只有本地容器可以开始 - > [求助1]远程服务器上的货物Maven

我有波纹管的配置:

  <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> 

回答

0

如果你要使用远程服务器,然后有这两个货运目标,您可以使用:

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

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

如果您在您的配置中用<goal>deploy</goal><goal>stop</goal>替换<goal>start</goal><goal>undeploy</goal>那么您应该摆脱此错误。