如何使用哈德逊 +行家+货物用于将应用程序部署到jboss服务器?

发布于 2024-10-14 20:26:29 字数 4572 浏览 4 评论 0原文

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

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

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

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

我现在要求的是解决这个小问题的某种解决方法。我花了很长时间(大约 16 个小时)才达到这个状态,如果我必须完全返工,我会很不高兴。

我的想法怎么可能(但我无法在谷歌上搜索任何有用的东西):

  • 强制 hudson 在后台运行 Maven 任务
  • 强制 Cargo 在后台运行 jboss (一些spawn、fork、jvm 参数、jboss 运行时参数)
  • 强制 maven 运行 我尝试这个解决方案的

原因是我想让jboss在服务器上永久运行,而cargo远程部署选项对我来说并不好,因为它使用了太多的系统资源。该解决方案应该适合安装项目,然后重新启动服务器(停止 - 启动)。

感谢您的任何帮助。这是我的货物插件配置:

<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>

I would like to use hudson with maven plugin to deploy application to Jboss 6 server this way:

  1. Hudson calls maven clean install tasks
  2. In the pom.xml file is defined cargo plugin (version 1.0.6)
  3. The cargo plugin has defined execution redeploy for phase install with goals stop and start (in this order)

Everything works fine - the project is cleaned and then installed, then the jboss server is stopped (using cargo:stop) and started again (using cargo:start). During the start goal is the war with my project deployed to jboss. When I test my web, it works and all changes are present.

The only problem is, that after the Jboss server is started, maven does not finish its execution successfuly because it shows the message "[INFO] Press Ctrl-C to stop the container..." and waits to press Ctrl-C. This is standard cargo:start behaviour. The result is, that Hudson job does not finish successfuly.

What I am asking for now is som kind of workaround for this one small problem. It takes me long time (about 16 hours) to get to this state and I would not be glad if I had to rework it completely.

My ideas how could it go (but I was not able to google anything useful):

  • force hudson to run maven task in background
  • force cargo to run jboss in background (some spawn, fork, jvm parameter, jboss runtime argument)
  • force maven to run task in background

The reason why I have trying this solution is that I want to have jboss running permanently on the server and the cargo remote deploy option is not good for me, because it uses too much of system resources. This solution should be good for installing project and then restart server (stop - start).

Thanks for any help. Here is my cargo plugin configuration:

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

別甾虛僞 2024-10-21 20:26:29

属性设置为 true 怎么样?根据 文档

<wait>  Decides if Cargo should wait after the container is 
            started or not                                   Defaults to true 

How about setting <wait> property to true? According to the docs

<wait>  Decides if Cargo should wait after the container is 
            started or not                                   Defaults to true 
仅此而已 2024-10-21 20:26:29

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

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

查看 Hudson wiki 此处
或者 Jenkins wiki 此处

詹金斯和哈德森基本上是同一件事,但最近分裂了。我会让您阅读 Jenkins 组和 Oracle Hudson 小组。编辑:还有SO问题如何在Hudson和Jenkins之间进行选择?

Hudson monitors all running processes and will not consider a build done until they all end. I am not familiar with cargo, but here are my notes from my experiences with Hudson. To get a process through the monitor net you may need to:

  • Run JBoss in the background
  • Set the environment variable -Dhudson.util.ProcessTreeKiller.disable to true in your Hudson configuration
  • Set BUILD_ID=dontKillMe as a shell environment variable

Check out the Hudson wiki here.
Or the Jenkins wiki here.

Jenkins and Hudson are basically the same thing, but two sides to a recent splitting. I'll let you read the details from the Jenkins group and the Oracle Hudson group. Edit: also the SO question How to choose between Hudson and Jenkins?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文