Ever since I started working on OpenMRS code, I would have to reload the servers everytime I made a change in the Backend code. There are tools like spring-loaded (which I was unable to setup after spending nearly 2-3 days during my GSoC project for my module) and regular Intellij Hotswap that allows only class reloading without redeploying,
I was looking for a tool and found the most popular one to be jRebel . It supports regular UI changes, Class Reloading, Spring and Hibernate. You can see all your changes dynamically be it from Spring controllers or even Hibernate DAOs. Basically, you never really have to redeploy code again. Best part is that it integrates seamlessly with Eclipse AND Intellij and also works with Jetty and Tomcat, both of which developers use at OpenMRS.
Though the enterprise edition is paid, they have a free, all features included version for personal and non commercial use. They don’t advertise this version on their website at all (for obvious reasons) but I had someone from the jRebel team tell and guide me to this free version when I told them it was for Open Source software.
You can see the quick start instructions for Eclipse and Intellij after you have gotten the license from the link I have mentioned. To get a free license, all you have to do is link up one of your social media accounts with jRebel.
I felt that a lot of the developers would find this tool really useful and figured sharing it would help someone spend more time coding for OpenMRS and less time redeploying (like me!).
Tell me what you guys think if you try it out! Shouldn’t take more than 5 minutes to setup everything from license to plugin and the results are awesome
Thanks @bholagabbar for sharing!
As you can see here, some years ago, we had Justin Miranda setting up JRebel for OpenMRS development http://listarchives.openmrs.org/Using-JRebel-to-hot-deploy-OpenMRS-classes-jsps-during-development-td4595517.html
What is lacking is a current wiki page describing the exact step by step guide in reference to OpenMRS. Do you have the time to do such?
Sure! I have it setup with another Java project using the exact same stack as OpenMRS https://github.com/WolfBeacon/5_server and it works like a charm.
The archive is like from way back and as of today, jRebel has become extremely simple to use. I shall try and write a wiki page, but for the time being, the steps should roughly be
Get the free licence from the above link
Download the plugin for your IDE
Right click on the main project folder in the project window and tick enable jRebel (could be IDE specific so read the instructions from the links I put up for your IDE)
Open up the jRebel module window and tick all the OpenMRS modules in your workspace.
Run the server in jExecutor window as per IDE config.
After you make changes in code, be sure to run Make module/compile module code command
@dkayiwa If you have the time, do tell me if these steps work. I know you use Eclipse so you can use the link I mentioned in the previous comment to see if you can get it to run
Yes, I wouldn’t want to write one up before I thoroughly test if it’s working. I shall do so as soon as I find time. Meanwhile if anyone in the community has a few minutes to spare and can actually verify the same, then that would great!
Is JRebel config IDE-specific? Or is there any chance the SDK could help developers in getting set up (i.e., automate or semi-automate some of the steps)?
I’m not sure. There are separate plugins for both IDEs. However I think what these plugins do is simply add a bunch of parameters in the VM. For configuration, jRebel uses a pom.xml file.
We would have to get in touch with the developers there for more details. It would be awesome if we could actually get it to work with the SDK because then the SDK would be all inclusive.
However, there is another open source alternative to jRebel called DCEVM which would make a lot of sense. Maybe @raff could provide us with some insight?
I would like if someone, possibly @dkayiwa, @pascal or @raff try out jRebel and see if it works for them. As I mentioned, it shouldn’t take more than 10 minutes. I’m stuck between university exams and have lost all my config files, deploy scripts and module downloads since I switched my OS so it would take a while for me to get setup again. I intend to try it out soon, but it would be great to get definitive feedback from any /dev/5 in the meantime
It would also be helpful to understand why spring-loaded didn’t work, since I think this is already supposed to work with the SDK.
Yes I’m glad you asked. The OpenMRS Cohort Module has the REST controllers built in along with the view and other Spring controllers. Now I configured spring loaded as mentioned on @ssmusoke 's blog here https://ssmusoke.com/2015/09/24/openmrs-module-development-learnings-102/ and during the build, it threw me errors pointing to the folder that contains the REST controllers. So I figured spring-loaded wasn’t configured to run/be compatible with such a module layout. Also, back then there was a ticket in JIRA that said ‘integrate spring loaded into SDK’ I’m not sure if it’s solved yet. I remember @dkayiwa showing me that ticket.
This was like 3 months back so my exact details might be off but this was roughly what I figured the problem was from the logs. I’m definitely gonna configure jRebel as soon as I pick up development.
I know its quite some time but I am trying to upgrade our jetty for development in openmrs-core and am wondering if you got JREBEL to work?
Or if anyone is using JREBEL?
Since there is still an old config for it in the pom.xml and I have no experience with it but would like to update jetty and am wondering if we can delete the jrebel confi/create an issue for a fresh jrebel setup.
It has been very many years ago since we last tried out JRebel. @justin who was the expert, last talked about it around 7 years ago. http://blog.justinmiranda.com/2010/02/hotswap-this.html
So i do not see any problem with you deleting its config.