Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven2: Cargo plugin hot deployment & Jonas support

I am trying to get the Cargo plugin works on my maven project in order to benefit from war hot-deployment targetting the Jonas server.

The official documentation is not that clear on what is supported and what is not (for example you can find this: http://cargo.codehaus.org/Hot+Deployment but also this http://cargo.codehaus.org/JOnAS+4.x).

Anyway I have the following coniguration in for my war's POM:

<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.0</version>
    <configuration>
        <container>
            <containerId>jonas4x</containerId>
            <home>C:\JOnAS-4.8.4\nt\bin</home>
        </container>

        <configuration>
            <type>existing</type>
            <home>C:\JOnAS-4.8.4</home>
        </configuration>
    </configuration>
</plugin>

And when I run

mvn cargo:deploy

on my project, the war is copied to the Jonas webapps folder but there is no hot deployment. The file is only copied but the hot deploy Jonas command is not called so that my modifications are not available immediatly.

EDIT: I also tried to add a deployer configuration as suggested on the answers but the behaviour is the same (ie: war is copied but the Jonas hot deploy command is not called so that the war is not reloaded in Jonas).

Am I missing something or am I right saying the Cargo Maven plugin does not support Jonas Hot Deployement?

Thanks in advance!

like image 795
reef Avatar asked Nov 14 '22 15:11

reef


1 Answers

The cargo page on deploying to a running container links to a table listing the version where hot deployment was introduced for that container. According to the table, JOnAS 4.x is supported from version 1.0 (which you are using), so it should work.

On that page it also has some guidelines for configuring the plugin for deployment, I've attempted to interpret them below.

From the home element in your configuration I assume you are attempting a local deployment. The configuration in the running container page implies that the hot-deployment should be automatic in this line at the end:

Just type mvn cargo:deploy. Notice that we haven't specified a element nor a one. This is because the plugin is smart enough to create default instances for you. Cool, isn't it?

However the earlier configuration block indicates you should configure the deployer section to make the cargo plugin aware of the war to be deployed. The configuration for the deployer would be something like this:

<deployer>
  <type>local</type>
  <deployables>
    <deployable>
      <groupId>${project.groupId}</groupId>
      <artifactId>${project.artifactId}</artifactId>
      <type>war</type>
      <properties>
        <context>optional root context</context>
      </properties>
      <pingURL>optional url to ping to know if deployable is done or not</pingURL>
      <pingTimeout>optional timeout to ping (default 20000 milliseconds)</pingTimeout>
    </deployable>
  </deployables>
</deployer>

If the automatic option isn't working for you, consider declaring the configuration for your war.

like image 129
Rich Seller Avatar answered Feb 05 '23 08:02

Rich Seller