如何使用cargo-maven2-plugin部署tomcat?

时间:2014-12-03 07:11:13

标签: java maven tomcat

我想使用cargo-maven2-plugin将web-app部署到我的其他主机。(ps:其他主机是ubuntu os。)我设置了tomcat-users.xml:

<role rolename="manager-script"/>
<user username="admin" password="admin" roles="manager-script"/>

并将上下文添加到pom.xml:

<plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.4.4</version>
                <configuration>
                    <container>
                            <containerId>tomcat7x</containerId>
                            <type>remote</type>
                    </container>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.hostname>10.23.0.3</cargo.hostname>
                            <cargo.servlet.port>8080</cargo.servlet.port>
                            <cargo.remote.username>admin</cargo.remote.username>
                            <cargo.remote.password>admin</cargo.remote.password>
                        </properties>
                    </configuration>
                </configuration>
            </plugin>

用以下方式运行maven:

cargo:deploy

不起作用:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building vmojing-web 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- cargo-maven2-plugin:1.4.4:redeploy (default-cli) @ vmojing-web ---
[INFO] [DeployerRedeployMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-tomcat:jar:1.4.4 for container tomcat7x
[INFO] [mcat7xRemoteDeployer] Redeploying [F:\v11-eclipse-workspace\vmojing\vmojing-web\target\vmojing-web.war]
[INFO] [mcat7xRemoteDeployer] Undeploying [F:\v11-eclipse-workspace\vmojing\vmojing-web\target\vmojing-web.war]
[INFO] [mcat7xRemoteDeployer] Deploying [F:\v11-eclipse-workspace\vmojing\vmojing-web\target\vmojing-web.war]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.564 s
[INFO] Finished at: 2014-12-03T15:09:00+08:00
[INFO] Final Memory: 6M/16M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy (default-cli) on project vmojing-web: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy failed: Failed to deploy [F:\v11-eclipse-workspace\vmojing\vmojing-web\target\vmojing-web.war]: FAIL - Deployed application at context path /vmojing-web but context failed to start -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

我不知道这个错误,我尝试检查主机的tomcat,它确实收到了webapps文件中的vmojing-web.war。但是它不起作用。我将pom.xml的主机名更改为my localhost,它工作。谁能告诉我为什么?我该怎么办?

0 个答案:

没有答案