Onkar Salvi
Onkar Salvi

Reputation: 151

Hot Swap agent Configuration for multi module project


I need help in configuring hotswap agent in my project for hot deploying class files.
In my project we have project setup like below :

WebProject (war)
|
|_ _ Service Project(jar)


Service project is used as a jar file in web project. So whenever I do changes in a java file inside service project i want hotswap agent to reload/replace its class file with the latest one without the need of deploying the entire project again.

I have downloaded dcevm(dynamic code evolution vm) for jdk 1.7.51 and hotswap-agent.jar file as well and also done eclipse configuration. Whenever I do changes in WebProject's .java, .properties files it reloads it automatically without deploying the application again. Now I just want to configure my hotswap agent in such a way that If i am doing changes in java file inside service project which is used as a jar file inside Web Project, it should reload that .class file or .jar file again.

Do I need to add one more hotswap-agent.properties file in resource folder of service project? Currently i have added it in resource folder of web project.

Any help is very much appreciated.

Upvotes: 5

Views: 5610

Answers (2)

Onkar Salvi
Onkar Salvi

Reputation: 151

I have configured hot swap agent for multi module project. In Web project i have added hotswap-agent.properties file. In hotswap-agent.properties file added path to the service projects target directory like this

extraClasspath=D:/Sample/serviceproject/target/classes

and now it is reloading files from above mentioned directory.

Upvotes: 4

edudant
edudant

Reputation: 719

Configuration file hotswap-agent.properties is loaded at runtime from classpath root (i.e. WEB-INF/classes for webapp project). If you have standard maven directory layout, put it into src/main/resources.

Use extraClasspath property as described in hotswap-agent.properties:

# Add a directory prior to application classpath (load classes and resources).
#
# This may be useful for example in multi module maven project to load class changes from upstream project
# classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to
# classes from built JAR file.
extraClasspath=

Example with maven layout:

extraClasspath=_PATH_TO_Service_Project_/target/classes

Upvotes: 2

Related Questions