How to use hudson + maven + cargo for deploying application to jboss server?
I would like to use hudson with maven plugin to deploy application to Jboss 6 server this way:
- Hudson calls maven clean install tasks
- In the pom.xml file is defined cargo plugin (version 1.0.6)
- The cargo plugin has defined execution redeploy for phase install with go开发者_开发百科als 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>
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
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?
精彩评论