Maven2: Cargo plugin hot deployment & Jonas support

本秂侑毒 提交于 2019-12-07 06:20:15

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/1394389/maven2-cargo-plugin-hot-deployment-jonas-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!