我正在尝试设置 Maven 货物插件。我有以下要求:
- tomcat 6
- 自定义 server.xml
- 自定义 context.xml
- log4j jar 部署到 tomcat lib
- 如果机器上不存在,则安装 tomcat 已经
- 绑定到 maven 的安装生命周期阶段来部署战争并重新启动容器
- 使部署的战争是 ROOT.war
我遵循以下内容: http://www.java-tutorial.ch/maven/maven-tomcat-deployment-using-cargo。这不是我想要的完整功能集,甚至它也不能完全工作。这就是我得到的结果:
Can't load log handler "4host-manager.org.apache.juli.FileHandler"
[INFO] [talledLocalContainer] java.lang.ClassNotFoundException: 4host-manager.org.apache.juli.FileHandler
然后当 mvn install 返回时,我执行 ps -ef 并且没有 tomcat 进程。
它还会将战争复制到 ROOT.war,但旧的 ROOT/ 目录不会被替换,因此新的 ROOT.war 并未实际部署。
对于“安装 tomcat,如果尚未存在”的要求,看起来这应该是绝对简单的,但是当我提供
<zipUrlInstaller>
<url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip</url>
<extractDir>/usr/local</extractDir>
</zipUrlInstaller>
并运行 mvn Cargo:install 时,它会抛出以下错误:
org.codehaus.cargo.container.ContainerException: Failed to get container installation home as the container has not yet been installed. Please call install() first.
这是令人费解的。它要我先调用安装,但我正在调用安装。
有想法吗?
I'm trying to setup maven cargo plugin. I have the following requirements:
- tomcat 6
- custom server.xml
- custom context.xml
- log4j jar deployed to tomcat lib
- install tomcat on the machine if it's not there already
- tie to maven's install lifecycle phase to deploy a war and restart the container
- make the deployed war be ROOT.war
I've followed the following: http://www.java-tutorial.ch/maven/maven-tomcat-deployment-using-cargo. This isn't the complete feature set I want, and even it doesn't work entirely. This is what I get:
Can't load log handler "4host-manager.org.apache.juli.FileHandler"
[INFO] [talledLocalContainer] java.lang.ClassNotFoundException: 4host-manager.org.apache.juli.FileHandler
And then when mvn install returns I do ps -ef and there's no tomcat process.
Also it copies the war to ROOT.war but the old ROOT/ directory is not replaced so the new ROOT.war doesn't actually get deployed.
For the "install tomcat if not already there" requirement, it seems like this should be absolutely straightforward, yet when I provide
<zipUrlInstaller>
<url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip</url>
<extractDir>/usr/local</extractDir>
</zipUrlInstaller>
and run mvn cargo:install, it throws this:
org.codehaus.cargo.container.ContainerException: Failed to get container installation home as the container has not yet been installed. Please call install() first.
Which is puzzling. It wants me to call install first, but I AM calling install.
Ideas?
发布评论
评论(1)
您关注的链接提供了 Cargo 1.0.6 的演示。最新可用版本是 1.1.1,因此我建议您使用最新版本,并且子标签中有某些更改
如帖子 http://cargo.codehaus.org/Deploying+to+a+running+container。 ZipUrlInstaller 的子标签有一些变化。
尝试使用 Maven archetype 在帖子 http://cargo.codehaus.org/Maven2+Archetypes 之后创建货物示例项目。我建议您使用“Single Webapp Module Archetype”
设置maven项目后,您可以运行 mvn Cargo:install -P tomcat6x 命令安装 tomcat 6。
“单个 webapp 模块原型”的 pom.xml 片段可能对您有用。
其中 wait 参数 true 将为您提供检查服务器是否正在运行的选项。
Link you followed has given demo for cargo 1.0.6. Recent version available is 1.1.1 so I suggest you to use recent and there is certain changes in child tags
As described in post http://cargo.codehaus.org/Deploying+to+a+running+container. There are ceratin changes in child tags of ZipUrlInstaller.
Try to use maven archetype to create cargo sample project following post http://cargo.codehaus.org/Maven2+Archetypes. I suggest you to user "Single Webapp Module Archetype"
After setting up maven project, You can install tomcat 6 running mvn cargo:install -P tomcat6x command.
pom.xml snippet of "single webapp module archetype" which can be useful for you.
where wait parameter true will give you option to check whether server is running or not.