<profile> <id>jrebel</id> <build> <plugins> <plugin> <groupId>org.zeroturnaround</groupId> <artifactId>jrebel-maven-plugin</artifactId> <version>1.1.5</version> <executions> <execution> <id>generate-rebel-xml</id> <phase>process-resources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile>
Evaluating JRebel for WildFly and IntelliJ IDEA
TweetPosted on Wednesday Jan 21, 2015 at 10:41PM in Technology
I’m evaluating myJRebel which is free, for personal, non-commercial use only version of JRebel. it enables hot-deployment of classes. its quick start guide for IntelliJ IDEA is nice and easy to understand.
I used an example project which used in my past posting Exploded deployment for WildFly on development and Conditional inclusion of whole element for deployment descriptor with Maven for evaluate JRebel.
Installation is very easy. we can just follow the quick start guide. my recipe is as follows:
-
Just find and install JRebel plugin from plugin installation window of IntelliJ IDEA
-
After restart, enter your activation key (get yours from https://my.jrebel.com/) in Help ⇒ JRebel Activation window
-
Add a definition of JRebel Maven Plugin. I prefer to put definition to a profile because sometimes I make my project public on GitHub or somewhere and not everyone can use JRebel
-
Enable a profile named
jrebel
in Maven Projects window (make sure to check if/WEB-INF/classes/rebel.xml
exists in the target directory after build) -
Launch your application server with a newly added Run with JRebel icon on upper-right. you would see some logging messages from JRebel in your console
After installation, I did some experiment that modifying a method of CDI managed bean which returns a constant string. it works fine, and pressing Command+F9 (Make Project) after modification is good so that JRebel can reflects changes immediately. also Update classes and resources On frame deactivation works fine but I felt some delay to reflect for about 1 or 2 seconds.
It works fine during the evaluation and it was very nice. it properly enabled server side Java development without deployment. I would apply it to my project.
Also I found a book named "Instant JRebel" (published on 2013). I haven’t read it but it might be good for beginners.
Conditional inclusion of whole element for deployment descriptor with Maven
TweetPosted on Wednesday Jan 21, 2015 at 11:26AM in Technology
Sometimes I need to tweak deployment descriptors (e.g. web.xml) for different environment (e.g. development/integration-test/production). I frequently see the case which tweaks only values of context-param, or choose appropriate one from separated files for each environment but I’m looking for a way to include or exclude whole an element using single template. I found a solution so I leave some note about that.
pom.xml
Specify <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
in plugin configuration.
<build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors> </configuration> </plugin> </plugins> </build>
Define variables for each environment. in my case I need to include a context-param of JSF for development environment only. if I didn’t use profile named development
when the time of build, then that context-param will be simply excluded from web.xml.
<profiles> <profile> <id>development</id> <properties> <context-params><![CDATA[ --> <context-param> <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name> <param-value>0</param-value> </context-param> <!-- ]]></context-params> </properties> </profile> <profile> <id>default</id> <properties> <context-params></context-params> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> </profiles>
web.xml
Just put an expression inside XML comment syntax. it’s intended to avoid that complaining XML editor of your IDE.
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <!-- ${context-params} --> ... </web-app>
Processed web.xml
If I build with mvn clean package -P development
then web.xml will be:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <!-- --> <context-param> <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name> <param-value>0</param-value> </context-param> <!-- --> ...
If I use mvn clean package
then web.xml will be:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <!-- --> ...
Tags: maven