1

我想使用带有 maven 插件的 hudson 以这种方式将应用程序部署到 Jboss 6 服务器:

  1. Hudson 调用 maven 全新安装任务
  2. 在 pom.xml 文件中定义了 cargo plugin(版本 1.0.6)
  3. cargo 插件已经为阶段安装定义了执行重新部署,目标停止和启动(按此顺序)

一切正常 - 项目被清理然后安装,然后 jboss 服务器停止(使用 cargo:stop)并再次启动(使用 cargo:start)。在开始的目标是与我的项目部署到 jboss 的战争。当我测试我的网络时,它可以工作并且所有更改都存在。

唯一的问题是,在 Jboss 服务器启动后,maven 没有成功完成其执行,因为它显示消息“[INFO] Press Ctrl-C to stop the container...”并等待按 Ctrl-C。这是标准的 cargo:start 行为。结果是,Hudson 作业没有成功完成。

我现在要求的是针对这个小问题的某种解决方法。我需要很长时间(大约 16 个小时)才能达到这种状态,如果我不得不完全重新加工它,我不会很高兴。

我的想法怎么会去(但我无法谷歌任何有用的东西):

  • 强制哈德森在后台运行 maven 任务
  • 强制 cargo 在后台运行 jboss(一些 spawn、fork、jvm 参数、jboss 运行时参数)
  • 强制maven在后台运行任务

我之所以尝试这个解决方案是因为我想让 jboss 在服务器上永久运行,而货物远程部署选项对我不利,因为它使用了太多的系统资源。该解决方案应该适用于安装项目然后重新启动服务器(停止 - 启动)。

谢谢你的帮助。这是我的货物插件配置:

<plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.0.6</version>
            <configuration>
                <container>
                    <containerId>jboss6x</containerId>
                    <append>false</append>
                    <timeout>300000</timeout>
                    <home>/atteq/jboss</home>
                </container>
                <configuration>
                    <properties>
                        <cargo.servlet.port>8080</cargo.servlet.port>
                        <cargo.jboss.configuration>atteq-minimal</cargo.jboss.configuration>
                        <cargo.logging>high</cargo.logging>
                        <cargo.rmi.port>1099</cargo.rmi.port>
                        <cargo.jvmargs>-XX:PermSize=512m -XX:MaxPermSize=1024
                        -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled
                        -XX:+CMSClassUnloadingEnabled</cargo.jvmargs>
                        <cargo.runtime.args>--host 0.0.0.0</cargo.runtime.args>

                    </properties>
                        <type>existing</type>
                    <home>/atteq/jboss/server/atteq-minimal</home>
                <deployables>
                    <deployable>
                        <groupId>roztocto</groupId>
                        <artifactId>roztocto</artifactId>
                        <type>war</type>
                    </deployable>
                </deployables>

                    </configuration>
                </configuration>
            <executions>
                <execution>
                    <id>redeploy</id>
                    <phase>install</phase>
                    <goals>
                        <goal>stop</goal>
                        <goal>start</goal>
                    </goals>
                </execution>
            </executions> 
            <dependencies>
                    <dependency>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-core-tools-jboss-deployer-5.1-and-onwards</artifactId>
                        <version>1.0.6</version>
                    </dependency>
                <dependency>
                    <groupId>org.jboss.jbossas</groupId>
                    <artifactId>jboss-as-profileservice-client</artifactId>
                    <version>6.0.0.Final</version>
                    <type>pom</type>
                </dependency>

                    <dependency>
                        <groupId>org.jboss.profileservice</groupId>
                        <artifactId>jboss-profileservice-spi</artifactId>
                        <version>0.2.2</version>
                    </dependency>

                    <dependency>
                        <groupId>org.jboss.jbossas</groupId>
                        <artifactId>jboss-as-client</artifactId>
                        <version>6.0.0.Final</version>
                        <type>pom</type>
                    </dependency>
            </dependencies>

        </plugin>
4

2 回答 2

2

将属性设置<wait>为true怎么样?根据文档

<wait>  Decides if Cargo should wait after the container is 
            started or not                                   Defaults to true 
于 2011-01-31T12:16:55.723 回答
1

Hudson 监视所有正在运行的进程,并且在它们全部结束之前不会考虑构建完成。我对货物不熟悉,但这是我在哈德逊的经历中的笔记。要通过监控网络获取进程,您可能需要:

  • 在后台运行 JBoss
  • 在 Hudson 配置中将环境变量 -Dhudson.util.ProcessTreeKiller.disable 设置为 true
  • 将 BUILD_ID=dontKillMe 设置为 shell 环境变量

在这里查看 Hudson wiki 。或者这里的 Jenkins wiki 。

詹金斯和哈德森基本上是同一件事,但最近分裂的两个方面。我会让您阅读Jenkins小组和Oracle Hudson小组的详细信息。编辑:也是这样的问题如何在哈德逊和詹金斯之间进行选择?

于 2011-04-27T20:21:50.567 回答