Maven: Как развернуть файл WAR на удаленном сервере Tomcat? - PullRequest
2 голосов
/ 08 декабря 2011

Я использую Maven 3.0.3. Я хочу развернуть файл WAR на удаленном сервере Tomcat 6, на котором запущено приложение менеджера Tomcat, на этапе проверки моего проекта. Как я могу это сделать? Я думал, что плагин Cargo был ключом к спасению, но когда я добавил это в свой файл 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]

Спасибо за любые предложения, - Дэйв

1 Ответ

2 голосов
/ 08 декабря 2011

В соответствии с этими инструкциями и на основании вашего сообщения об ошибке попробуйте удалить элемент <type>remote</type> под тегом <deployer> и повторите попытку.

...