Hot reload of XHTML files (5.2-M2 and after)

XHTML files can be hot reloaded. In order to activate this, you need to update the nuxeo.ear/config/nuxeo.properties files and uncomment the facelets.REFRESH_PERIOD=2 line (requires restart of Jboss).

The xhtml files will then be reloaded from nuxeo.ear/nuxeo.war/. You can directly edit the xhtml files from here or copy manually the xhtml files you edited from your IDE into this directory.

NB : for production, this option has to be disabled

Hot reload of Seam components (5.2 only)

Seam components can also be hot redeployed. This can save a lot of time (and Jboss restarts).

Activating Seam Hot Reload

To activate Seam Hot reload you need to create the file nuxeo.ear/config/seam-debug.properties.

This file can be empty.

Selecting the Seam Components that can be Hot Reloaded

Because of the way Seam Hot Reload works, you have to select what Seam Components must be hot reloadable. This is done by telling the deployment system what classes must be reloadable.

This can be done in 2 places :

  • in the seam.properties inside the jar that contains the code you are working on
  • in the seam-debug.properties that is in the config directory
The first option is the better because it tells the deployer what jars must be hot reloadable.

So, if you have a TestBean that you want to make hot reloadable, edit a the seam.properties and add :

org.nuxeo.ecm.webapp.seam.TestBean=true

How it works and what are the limitations

During deployment preprocessing, the "hot reloadable jars" will be splitted :

  • Seam classes made for hot reload will be copied into nuxeo.ear/nuxeo.war/WEB-INF/dev
  • other jar ressources (class, xml, manifest ...) will remain in another jar that will be deployed instead of the original one
Classes in nuxeo.ear/nuxeo.war/WEB-INF/dev will be deployed by Seam in a separated class loader and will be hot reloadale.

Since these classes are in a child classloader they can access other Seam components, but other Seam components can not see them.

How do I reload my classes

You have to copy your updated classes into nuxeo.ear/nuxeo.war/WEB-INF/dev.

To trigger the hot reload you can either :

How do I automatically hot reload with ant

You add this code to your ant script :

<target name="seam" depends="clean-seam-hotdeploy-dir">
 <antcall target="maven">
   <param name="mvn.lifecycle" value="clean"/>
 </antcall>
 <antcall target="maven">
   <param name="mvn.lifecycle" value="compile"/>
 </antcall>
 <echo message="Deploy Seam components in ${seam.hotdeploy.dir}"/>
 <copy todir="${seam.hotdeploy.dir}" flatten="false">
   <fileset dir="./target/classes">
     <include name="**/*.class"/>
   </fileset>
 </copy>
 <get dest="./seam_hotdeploy_result.html" src="http://127.0.0.1:8080/nuxeo/restAPI/seamReload" username="Administrator" password="Administrator"/>
</target>

<target name="clean-seam-hotdeploy-dir">
 <delete>
   <fileset dir="${seam.hotdeploy.dir}">
     <include name="*"/>
   </fileset>
 </delete>
</target>

and launch

ant seam
Version 13.3 last modified by Thierry Martins on 26/10/2009 at 14:38

Comments 0

No comments for this document

Attachments 0

No attachments for this document

Creator: Thierry Delprat on 2009/04/24 19:01
© 2008-2010 Nuxeo
1.3.8295