Get Jet pack for Mifso X development !^!
Yes, you read it right, you can get a set of Jet pack for Mifos X development. If you are looking for zero turnaround time (practically <10secs) to see the your code changes propagating to running application (without rebuilding app and restarting the app server)
jRebel is the ultimate solution!
I will be brief about how to set up jRebel for Mifos X dev environment, if you are using Eclipse as IDE.
I assume, you are familiar with Mifos X development and already have MIfos X dev env setup in Eclipse. (I use STS, is wrapper on Eclipse, for this setup context it as good as Eclipse)
STEP 1: Install jRebel plugin into IDE
To install JRebel for Eclipse, access Help > Eclipse Marketplace…. When opening it for the first time, you may need to pick a solution catalog. Select Eclipse Marketplace and search for JRebel. Click Install once found.
After restarting Eclipse you most likely won’t have a license yet. The plugin will notify you about this sad fact. This happens via a popup notification:
Click the link in this popup. The JRebel activation window will immediately open. You can also open it from Help > JRebel Activation.
This window contains the following:
If you don’t have a JRebel license yet - click the link to open a web browser and apply for a totally free evaluation license.
If you have a license and want to register it - if you are awesome and already own a JRebel license then here is where you can apply it. There are three options to do this:
Paste license code from the clipboard - once you register for a free evaluation license, you will receive a license code via email and in the web browser. Paste this code here to activate it!
Choose license file from the disk - provided you bought a full license, you received the jrebel.lic file via email. Save this file in a location of your choice on your workstation and refer to it from here. Press Browse... to locate the file.
Specify License Server address - use this option if you get your JRebel license from a central license server. You will get this address from your administrator. You can enable or disable the option to use the proxy settings stored in your IDE - if your workstation setup requires this.
Press Apply or OK to store your chosen license information. Alternatively, press Cancel to dismiss the activation window.
Congratulations, you now have a fully functional JRebel installed!
STEP 3 :Project configuration
JRebel requires just one configuration file: rebel.xml. This is used by JRebel to map the running application to the workspace. The good news here is that the IDE plugin can automate the configuration for you. In fact, rebel.xml is generated automatically once you enable JRebel nature for the project.
It will generates rebel.xml at ~\mifosng-provider\src\main\resources\rebel.xml
And content of the file look similar to below xml
<classpath>
<dir name="F:/clients/mifos/mifosx/mifosng-provider/bin">
</dir>
</classpath>
dir tag refers to the directory in that IDE compiles the java class, Rebel needs to know when any code is changed, from where it needs to pick the recompiled files :)
JRebel does not compile Java code on its own. It relies on the compilation results from the Java compiler. For a smooth user experience with the tool it is recommended to enable the automatic build feature, also known as compile-on-save.
You can enable this option from the Project menu, by clicking Build Automatically menu item.
STEP 5 : Server configuration
Rebel need to where your application is running, since Mifos setup uses gradle task for building, deploying and starting the server. As we are not using standalone server to deploy and and run the server, In this case it is better run Rebel as javaagent.
To run jRebel as javaagent, download the current stable jRebel from here and extract the zip and locate the jrebel.jar, And then open the gradlew (~\mifosng-provider\gradlew) file in edit mode and add -javaagent:[location of jRebel extracted]/jrebel/jrebel.jar -noverify to JAVA_OPTS
Example configuration: JAVA_OPTS="-Xms512m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=512m -javaagent:F:/utilities/jrebel/jrebel.jar -noverify"
Save the file and restart the server with gradle command (i.e., gradlew clean tomcatRunWar)
STEP 6 : Confirm jRebel configuration is successful
When server is booting, first you will see jRebel logs (similar to below one)
Yep, jRebel agent is started! Once server is started do some simple code change and wait for IDE to recompile that class and verify those changes are reflected on the running application (you may try as simple as logging "Welcome to Jetpack development with jRebel" message :)
Be sensible to jRebel, do not expect big bang changes will be reloaded without issue.
Example 1: If you modify the constructor, then do not expect jRebel will re-initialize the objects which present in JVM with new constructor, but newly initialized object will be from modified construct :)
Example 2: If add new attributes to a class, jRebel injects the that attribute to old objects also nut do not expect value for that attribute it will be just NULL.
So jRebel for sure gives you Jetpack to do faster development.