2011-12-07 3 views
2

Maven 3.0.3을 사용하고 있습니다. 내 프로젝트의 검증 단계에서 Tomcat 관리자 앱을 실행하는 원격 Tomcat 6 서버에 WAR 파일을 배포하고 싶습니다. 어떻게해야합니까? 데이브Maven : WAR 파일을 원격 Tomcat 서버에 배포하려면 어떻게해야합니까?

- 내 pom.xml 파일이 추가 될 때 나는
 <plugin> 
      <groupId>org.codehaus.cargo</groupId> 
      <artifactId>cargo-maven2-plugin</artifactId> 
      <configuration> 
       <container> 
        <containerId>tomcat${tomcat.major}x</containerId> 
        <zipUrlInstaller> 
         <url>http://archive.apache.org/dist/tomcat/tomcat-${tomcat.major}/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.tar.gz</url> 
         <downloadDir>${project.build.directory}/downloads</downloadDir> 
         <extractDir>${project.build.directory}/extracts</extractDir> 
        </zipUrlInstaller> 
        <output>${project.build.directory}/tomcat${tomcat.major}x.log</output> 
        <log>${project.build.directory}/cargo.log</log> 
       </container> 
       <configuration> 
        <home>${project.build.directory}/tomcat-${tomcat.version}/container</home> 
        <properties> 
         <cargo.logging>high</cargo.logging> 
         <cargo.servlet.port>${tomcat.servlet.port}</cargo.servlet.port> 
         <cargo.tomcat.ajp.port>${tomcat.ajb.port}</cargo.tomcat.ajp.port> 
        </properties> 
       </configuration> 
      </configuration> 
      <executions> 
       <execution> 
        <id>start-container</id> 
        <phase>pre-integration-test</phase> 
        <goals> 
         <goal>start</goal> 
         <goal>deploy</goal> 
        </goals> 
        <configuration> 
         <deployer> 
          <deployables> 
           <deployable> 
            <groupId>${project.groupId}</groupId> 
            <artifactId>${project.artifactId}</artifactId> 
            <type>war</type> 
            <pingURL>http://localhost:${tomcat.servlet.port}/${project.artifactId}</pingURL> 
            <pingTimeout>30000</pingTimeout> 
            <properties> 
             <context>${project.artifactId}</context> 
            </properties> 
           </deployable> 
          </deployables> 
         </deployer> 
        </configuration> 
       </execution> 
       <execution> 
        <id>stop-container</id> 
        <phase>post-integration-test</phase> 
        <goals> 
         <goal>stop</goal> 
        </goals> 
       </execution> 
       <!-- In the verify phase, deploy the app to a Tomcat instance. We 
         require that the properties "tomcat.manager.url", "tomcat.username", and 
         "tomcat.password" be defined. 
       --> 
       <execution> 
        <id>deploy-to-remote-tomcat</id> 
        <goals> 
         <goal>deploy</goal> 
        </goals> 
        <phase>verify</phase> 
        <configuration> 
         <container> 
          <containerId>tomcat${tomcat.major}x</containerId> 
          <type>remote</type> 
         </container> 
         <configuration> 
          <type>runtime</type> 
          <properties> 
           <cargo.tomcat.manager.url>${tomcat.manager.url}</cargo.tomcat.manager.url> 
           <cargo.remote.username>${tomcat.username}</cargo.remote.username> 
           <cargo.remote.password>${tomcat.password}</cargo.remote.password> 
          </properties> 
         </configuration> 
         <deployer> 
          <type>remote</type> 
          <deployables> 
           <deployable> 
            <groupId>${project.groupId}</groupId> 
            <artifactId>${project.artifactId}</artifactId> 
            <type>${project.packaging}</type> 
           </deployable> 
          </deployables> 
         </deployer> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

내가 어떤 제안에 대한

Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.1.3:redeploy (deploy-to-remote-tomcat) on project myco-productplus-web: Execution deploy-to-remote-tomcat of goal org.codehaus.cargo:cargo-maven2-plugin:1.1.3:redeploy failed: Failed to create deployer with implementation class org.codehaus.cargo.container.tomcat.Tomcat6xRemoteDeployer for the parameters (container [id = [tomcat6x]], deployer type [remote]). argument type mismatch -> [Help 1] 

감사합니다, 오류를 얻을 ...화물 플러그인 구원의 열쇠라고 생각하지만,

+0

구성에 따라 Tomcat을 다운로드하여 시작하고 war 아카이브를 해당 Tomcat에 배포 (사전 통합 테스트) 한 다음 전쟁을 원격 tomcat (검증)에 배포하려고합니다. 거기에 좋은 이유가 있습니까? mvn을 호출하여 사전 통합 테스트, 통합 테스트를 확인하면이 경우 실행중인 단계가 확인됩니다. – khmarbaise

답변

2

these instructions에 따르면 오류 메시지에 따라 <deployer> 태그 아래의 <type>remote</type> 요소를 제거하고 다시 시도하십시오.

+0

귀하의 제안에 따라 " remote"을 삭제했습니다. 이렇게하면 오류가 사라지지만 적절한 속성 (예 : -Dtomcat.manager.url =)을 사용하여 "mvn clean verify"를 실행해도 성공한 경우에도 WAR 파일이 Tomcat 서버에 배포되지 않았습니다. 왜 더 이상한가요, 의도적으로 나쁜 tomcat 관리자 URL이나 암호를 넣을 때, 나는 여전히 빌드 성공을 얻었습니다. – Dave

+0

Btw, 내 문제가 여러 구성 인 것처럼 보였으므로 앞으로 나갔다가 받아 들였습니다. 그러나 다른 생각이 있다면 확실히 의견으로 답변하십시오. 감사, - – Dave

관련 문제