Hi every one I am very beginner to OpenMRS platform. Every time I change Java code, such as adding a new service class, do I need to manually redeploy my module to the OpenMRS server? Or is there a way to automatically deploy changes whenever I modify and build the project?
If so, what are the best practices for making the deployment process more efficient?
Yes, whenever you modify Java code in a module (such as adding a new service class), you need to redeploy the module for the changes to take effect. However, you can make this process more efficient using the OpenMRS SDK.
Efficient Ways to Deploy Changes
Using OpenMRS SDK for Fast Deployment
Instead of manually copying files, you can quickly deploy your module using:
mvn openmrs-sdk:deploy
Automatic Redeployment with Watch Mode (Hot Reloading)
OpenMRS SDK provides a watch mode that detects changes and redeploys automatically:
mvn openmrs-sdk:watch
This helps speed up development without needing manual redeployment.
Using Debug Mode for Hot-Swapping
Running OpenMRS in debug mode allows hot-swapping of some code changes without a full redeploy:
mvn openmrs-sdk:run -Ddebug=5005
You can then attach a debugger in IntelliJ or VS Code to test changes quickly.
Helpful Documentation
The documentation shared by @mherman22 (Deploying a Module) is very helpful and provides a detailed guide on how to deploy modules effectively. I highly recommend checking it out!
Let us know if you need further clarification. Happy coding!