<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Jrebel on Jean-Christophe Gay</title><link>https://jeanchristophegay.com/tags/jrebel/</link><description>Recent content in Jrebel on Jean-Christophe Gay</description><generator>Hugo -- gohugo.io</generator><language>fr-FR</language><copyright>© 2026 Jean-Christophe Gay</copyright><lastBuildDate>Tue, 18 Aug 2026 23:08:47 +0200</lastBuildDate><atom:link href="https://jeanchristophegay.com/tags/jrebel/index.xml" rel="self" type="application/rss+xml"/><item><title>JRebel, le redéploiement c'est à chaud !</title><link>https://jeanchristophegay.com/posts/jrebel-redeploiement-a-chaud/</link><pubDate>Sat, 02 Feb 2013 16:12:00 +0200</pubDate><guid>https://jeanchristophegay.com/posts/jrebel-redeploiement-a-chaud/</guid><description>&lt;p&gt;Quand on développe des applications web Java EE, on passe généralement son temps à redéployer son application et redémarrer son conteneur&amp;hellip;
Heureusement on peut compter depuis un moment sur &lt;a href="http://zeroturnaround.com/software/jrebel/features/#headline" target="_blank" rel="noreferrer"&gt;JRebel&lt;/a&gt; pour grandement augmenter sa productivité lors des développements en permettant le rechargement à chaud des modifications de façon plus poussé que le Hot Swap intégré à la JVM.&lt;/p&gt;

&lt;h1 class="relative group"&gt;Fonctionnement
 &lt;div id="fonctionnement" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#fonctionnement" aria-label="Ancre"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h1&gt;
&lt;p&gt;JRebel est un agent java qui va surveiller les modifications de notre application et les appliquées au sein de la JVM à chaud.
Pour celà, l’agent va scanner le classpath à la recherche de fichiers &lt;code&gt;rebel.xml&lt;/code&gt; décrivant les ressources à surveiller.&lt;/p&gt;

&lt;h1 class="relative group"&gt;Installation
 &lt;div id="installation" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#installation" aria-label="Ancre"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h1&gt;
&lt;p&gt;La documentation de JRebel met l’accent sur l’intégration avec les IDE (Eclipse, IntelliJ Idea, Netbeans, MyEclipse) et est très bien faite : &lt;a href="http://zeroturnaround.com/software/jrebel/download/#headline" target="_blank" rel="noreferrer"&gt;JRebel IDE Plugins&lt;/a&gt;
Personnellement j’utilise rarement les fonctionnalités de déploiement intégrés dans les IDE (peut-être à cause de wtp dans Eclipse&amp;hellip;) et préfère utilisé un serveur embedded (dans un plugin Maven par exemple) ou même directement le serveur d’application installé sur mon poste.&lt;/p&gt;
&lt;p&gt;On a donc besoin de télécharger une archive de JRebel, disponible ici : &lt;a href="http://zeroturnaround.com/software/jrebel/download/prev-releases/" target="_blank" rel="noreferrer"&gt;Télécharger JRebel&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Une fois dezippé, il faut exécuter la configuration de JRebel via &lt;code&gt;bin/jrebel-config.{cmd|sh}&lt;/code&gt; et suivre les instructions de l’assistant.
Pour ajouter l’agent JRebel à la JVM :
&lt;code&gt;-noverify -javaagent:$JREBEL_HOME/jrebel.jar&lt;/code&gt;&lt;/p&gt;

&lt;h1 class="relative group"&gt;Configuration de votre application
 &lt;div id="configuration-de-votre-application" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#configuration-de-votre-application" aria-label="Ancre"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h1&gt;
&lt;p&gt;Il faut maintenant s’intéresser à la génération des fichiers de configuration &lt;code&gt;rebel.xml&lt;/code&gt;.
Il existe un plugin Maven pour faire le travail à notre place : &lt;a href="http://zeroturnaround.com/software/jrebel/maven/" target="_blank" rel="noreferrer"&gt;http://zeroturnaround.com/software/jrebel/maven/&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;&amp;lt;plugin&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.zeroturnaround&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;jrebel-maven-plugin&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;1.1.3&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;configuration&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;classpath&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;resources&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;resource&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;includes&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;include&amp;gt;&lt;/span&gt;com/github/jcgay/**&lt;span class="nt"&gt;&amp;lt;/include&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/includes&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/resource&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;resource&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;directory&amp;gt;&lt;/span&gt;src/main/resources&lt;span class="nt"&gt;&amp;lt;/directory&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/resource&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/resources&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/classpath&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;executions&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;execution&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;id&amp;gt;&lt;/span&gt;generate-rebel-xml&lt;span class="nt"&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;phase&amp;gt;&lt;/span&gt;generate-resources&lt;span class="nt"&gt;&amp;lt;/phase&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;goals&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;goal&amp;gt;&lt;/span&gt;generate&lt;span class="nt"&gt;&amp;lt;/goal&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/goals&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/execution&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/executions&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Le plugin se base sur le type de votre module pour générer la configuration par défaut (pour par exemple intégrer &lt;code&gt;src/main/webapp&lt;/code&gt; aux ressources surveillées).
Ce comportement peut-être surchargé si par exemple votre webapp utilise le type maven jar en utilisant &lt;code&gt;war&lt;/code&gt; au sein de la configuration du plugin.
Le plugin fonctionne très bien au sein des projets multi-module.
On peut filtrer avec des include/exclude les ressources à intégrer dans le rechargement de JRebel.&lt;/p&gt;
&lt;p&gt;Les chemins générés au sein de la configuration sont absolus par défaut (donc spécifique à votre environnement), il est possible de variabiliser les chemins générés pour les rendre relatifs. Je n’ai jamais utilisé la fonctionalité (je ne package pas la configuration JRebel dans mes artifacts finaux) mais c’est toujours bon à savoir.&lt;/p&gt;
&lt;p&gt;Toutes les possibilités de configuration du &lt;code&gt;rebel.xml&lt;/code&gt; sont décrites ici : &lt;a href="http://manuals.zeroturnaround.com/jrebel-reference-manual/app.html#app-3.8" target="_blank" rel="noreferrer"&gt;documentation rebel.xml&lt;/a&gt;&lt;/p&gt;

&lt;h1 class="relative group"&gt;Vérification du fonctionnement
 &lt;div id="vérification-du-fonctionnement" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#v%c3%a9rification-du-fonctionnement" aria-label="Ancre"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h1&gt;
&lt;p&gt;Si l’agent est correctement configuré, on obtient au lancement de la JVM :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[2013-01-25 16:16:04] #############################################################
[2013-01-25 16:16:04] 
[2013-01-25 16:16:04] JRebel 5.1.1 (201211271929)
[2013-01-25 16:16:04] (c) Copyright ZeroTurnaround OU, Estonia, Tartu.
[2013-01-25 16:16:04] 
[2013-01-25 16:16:04] Over the last 30 days JRebel prevented 
[2013-01-25 16:16:04] at least 95 redeploys/restarts saving you about 3.9 hours.
[2013-01-25 16:16:04] 
[2013-01-25 16:16:04] This product is licensed to ******
[2013-01-25 16:16:04] 
[2013-01-25 16:16:04] The following plugins are disabled at the moment: 
[2013-01-25 16:16:04] * Click plugin (set -Drebel.click_plugin=true to enable)
[2013-01-25 16:16:04] * JRuby Plugin (set -Drebel.jruby_plugin=true to enable)
[2013-01-25 16:16:04] * Jersey plugin (set -Drebel.jersey_plugin=true to enable)
[2013-01-25 16:16:04] * Oracle ADF Core plugin (set -Drebel.adf_core_plugin=true to enable)
[2013-01-25 16:16:04] * Oracle ADF Faces plugin (set -Drebel.adf_faces_plugin=true to enable)
[2013-01-25 16:16:04] * RESTlet plugin (set -Drebel.restlet_plugin=true to enable)
[2013-01-25 16:16:04] * Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable)
[2013-01-25 16:16:04] * Spring Data Plugin (set -Drebel.spring_data_plugin=true to enable)
[2013-01-25 16:16:04] * WebObjects plugin (set -Drebel.webobjects_plugin=true to enable)
[2013-01-25 16:16:04] 
[2013-01-25 16:16:04] #############################################################
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Puis les ressources qui sont surveillées :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[2013-01-25 16:16:06] JRebel: Directory '/home/jcgay/dev/app/target/classes' will be monitored for changes.
[2013-01-25 16:16:06] JRebel: Directory '/home/jcgay/dev/app/src/main/webapp' will be monitored for changes.
[2013-01-25 16:16:06] JRebel: Directory '/home/jcgay/dev/app/src/main/resources will be monitored for changes.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Les classes seront maintenant rechargées dès qu’elles sont compilées depuis l’IDE (pour peu que celui ci soit bien configuré pour compiler les classes au même endroit que Maven).&lt;/p&gt;
&lt;p&gt;Les ressources sont rechargées après un hit sur le serveur d&amp;rsquo;application. Pour chaque ressource rechargée, une entrée est loggée :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[2012-12-20 11:33:56] JRebel: Reloading class 'com.github.jcgay.app.Person'.
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 class="relative group"&gt;Notes
 &lt;div id="notes" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#notes" aria-label="Ancre"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;La génération de la configuration via le plugin Maven est liée à la phase “generate-resources”. Il est possible que le reste du build écrase cette configuration (par exemple de l’overlay de war, ou du tissage d’aspect à partir du build d’un war dans ses modules). Génaralement dans ce cas je change la phase d’exécution du plugin Maven pour une phase postérieure à celle qui pose problème&amp;hellip;&lt;/li&gt;
&lt;li&gt;Attention à bien cocher “I use Maven to build my application” dans l’assistant de configuration de JRebel, sinon vous verrez surement le monitoring de plugin JRebel correctement s’activé mais pas celui des ressources de l’application.&lt;/li&gt;
&lt;li&gt;Dans IntelliJ Idea, pour que la compilation se fasse bien dans le même répertoire que Maven, il faut cocher “Use Maven output directories”.&lt;/li&gt;
&lt;li&gt;Toujours dans Idea, si l&amp;rsquo;on utilise le debugger, celui si se retrouvera désynchronisé dès la prise en compte d&amp;rsquo;un rechargement à chaud. Dans ce cas il faut installer le plugin JRebel, et ajouter la propriété &lt;code&gt;-Drebel.debugger_integration=true&lt;/code&gt; au lancement de la JVM.&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>