6.8. Hot Deploy
CUBA Platform supports Hot Deploy technology which helps to apply project changes to the running application immediately without the need to restart the application server. In essence, hot deployment is performed by copying updated resources and Java source files of the project to the configuration directory of the application, and then the running application compiles the source code and loads new classes and resources.
- How it works
-
When you make some changes in the source code, Studio copies the changed files to the configuration directory of the web application (
tomcat/conf/app
ortomcat/conf/app-core
). The resources in the configuration directory have priority over the resources in the JAR files of the application, so the running application will load these resources next time it needs them. If it encounters Java source files, it compiles them on the fly and loads the resulting classes.Studio also sends signals to the application to clear appropriate caches in order to make it load the changed resources. These are messages cache and the configurations of views, registered screens and menu.
When the application server is restarted, all files in the configuration directory are removed, and the JAR files contain the latest versions of your code.
- What can be hot deployed
-
-
XML descriptors and screen controllers (including static methods), located in the web and gui modules.
-
Middleware service implementations located in the core module.
-
Portal templates.
Other UI and middleware classes and beans, including their static methods, are hot deployed only if some screen file or a middleware service implementation that uses them has also been changed.
The reason for this is that class reloading is started by a signal: for screen controllers it is the screen reopening by a user, for services - Studio generates a special trigger file that is recognized by the server and is used to reload the particular service class and all its dependencies.
-
- What cannot be hot deployed
-
-
Any classes of the global module, including middleware service interfaces, entities, entity listeners etc.
-
- Usage of hot deploy in Studio
-
Hot deploy settings can be configured in Studio on the Help > Settings page:
-
The Hot deploy settings dialog allows you to configure mappings between source paths and Tomcat directories.
-
The Instant hot deploy checkbox allows you to turn off automatic hot deploy for the current project.
When the instant hot deploy is disabled, you can manually trigger it by running Run > Hot deploy conf menu command.
-