Wednesday, October 10, 2012

Set up JRebel on Intellij for Maven project.

What is JReble and what can it do for you?
http://en.wikipedia.org/wiki/JRebel

Step 1:

How to install JRebel plugin on your IDE (Intellij as example)?
http://zeroturnaround.com/software/jrebel/download/using-jrebel-with-intellij/

Step 2:

Configure JRebel for your maven project.



Add the following snippet to your parent pom.xml. The rebel.xml configuration file will be generated
for each individual sub-module of your maven project.

 <plugin>  
     <groupId>org.zeroturnaround</groupId>  
     <artifactId>jrebel-maven-plugin</artifactId>  
     <version>1.1.1</version>  
     <executions>  
         <execution>  
             <id>generate-rebel-xml</id>  
             <phase>process-resources</phase>  
             <goals>  
                 <goal>generate</goal>  
             </goals>  
         </execution>  
     </executions>  
 </plugin> 


      This will generate JRebel configuration file rebel.xml 
      automatically on every build. If you want to generate the rebel.xml 
      manually run mvn jrebel:generate -Drebel.xml.dir=OUTPUT_DIRECTORY 
      (by default OUTPUT_DIRECTORY is target/classes). 
      Adding -Drebel.generate.show=true will print out generated rebel.xml 
      at info level, so you can immediately see what was generated.
    

      By default, the generated rebel.xml contains absolute paths 
      to your workspace. However if you want to deploy the artifacts for your 
      team to use, you will need to make sure that the paths are relative 
      using a configurable custom property.


Step 3:

Set up JRebel for you tomcat.

Create a file startup-jrebel.sh in the dir of you TOMCAT_HOME/bin

and add following content into it.
 #!/bin/bash  
 export CATALINA_OPTS="-javaagent:/home/seaxio/.IdeaIC11/config/plugins/jr-ide-idea/lib/jrebel/jrebel.jar $CATALINA_OPTS"  
 `dirname $0`/catalina.sh $@  

Step 4:

Start debugging.

 Run sh startup-jrebel.sh jpda start  

Done. compaile your project (Itellij: ctrl + f9) after every code change.

Do not to redeploy your project and you can see the changes in the fly.

No comments:

Post a Comment