Aspirant
Aspirant

Reputation: 1954

Gradle: Hot deploy changes to a dependency

I have an environment where I have a java(spring mvc) webapp being developed by an n-member team on intellij with gradle as the build agent. This project has a dependency that is also being developed by the same team. The dependency is published to a repository from where it is read by the spring mvc app. What happens is that everytime there is a change to the dependency code, the spring app code has to be refreshed to include the latest version of the dependency code. So, the question is that is there a way to do a code swap at runtime in the dependency code and have it take affect in a debug session, pretty much like what JRebel does except that it needs to do it in the dependency code.

Any views on this would be highly appreciated.

P.S- I tagged gradle and jrebel because there might be a way to achieve this via this tech stack.

Upvotes: 0

Views: 849

Answers (1)

Anton Arhipov
Anton Arhipov

Reputation: 6591

JRebel can monitor the jars, though it is not super efficient. In rebel.xml configuration file you can specify a <jar> tag pointing to the location of the dependency in the file system.

A better approach would be to actually work with sources, so that you deploy the dependency with rebel.xml that points to the location where the compiled classes are, and then work with the dependency as with source, doing pull/update from version control when needed and compiling the changes. If your compiler is incremental, then it would compile only the changed classes and JRebel wouldn't have to reload too many classes at once, but only the changes.

Upvotes: 1

Related Questions