From 2a1ce87bfc0f054dbf4c980d7419416746c49795 Mon Sep 17 00:00:00 2001 From: Brian Long Date: Tue, 16 Mar 2021 21:37:51 -0400 Subject: [PATCH] added multiple paths to hotswap; README --- README.md | 27 +++++++++++++++++++++++++++ hotswap-agent.properties | 18 ++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..dbf09fa --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ + +# Java Application Container Image with Hot-Reloading + +This project creates a Docker image that has uses both the [Trava DCEVM](http://dcevm.github.io/) and [Hotswap Agent](http://hotswapagent.org/) and the Java JDWP debugger. The combination of these utilities allows for the hot-reloading of Java resources and classes to enable rapid application development and debugging capabilties. As a Docker image, containers can be started to facilitate development without requiring complicated installations on developer workstations. + +It is expected that containers are configured in Maven using the Fabric8 or Spotify Docker plugins. These configurations should expose the 8000 (debugger) port and any other port that the application may open. Most importantly, it should mount/bind the source code to the following possible paths. + +| Directory | Type | Hot-Reloaded | +| --------------------------------- |:---------:|:------------:| +| `/var/lib/jvm/dev/classes` | Classpath | Yes | +| `/var/lib/jvm/dev/classes-extra1` | Classpath | Yes | +| `/var/lib/jvm/dev/classes-extra2` | Classpath | Yes | +| `/var/lib/jvm/dev/classes-extra3` | Classpath | Yes | +| `/var/lib/jvm/dev/classes-extra4` | Classpath | Yes | +| `/var/lib/jvm/dev/classes-extra5` | Classpath | Yes | +| `/var/lib/jvm/dev/classes-extra6` | Classpath | Yes | +| `/var/lib/jvm/dev/classes-extra7` | Classpath | Yes | +| `/var/lib/jvm/dev/lib` | JARs | No | +| `/var/lib/jvm/dev/lib-extra1` | JARs | No | +| `/var/lib/jvm/dev/lib-extra2` | JARs | No | +| `/var/lib/jvm/dev/lib-extra3` | JARs | No | +| `/var/lib/jvm/dev/lib-extra4` | JARs | No | +| `/var/lib/jvm/dev/lib-extra5` | JARs | No | +| `/var/lib/jvm/dev/lib-extra6` | JARs | No | +| `/var/lib/jvm/dev/lib-extra7` | JARs | No | + +You may include your own `hotswap-agent.properties` in any of the `classes` folders. The one loaded by default is usually sufficient. diff --git a/hotswap-agent.properties b/hotswap-agent.properties index a9c342d..d3ec568 100644 --- a/hotswap-agent.properties +++ b/hotswap-agent.properties @@ -7,7 +7,14 @@ # 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=/var/lib/jvm/dev/classes +extraClasspath=/var/lib/jvm/dev/classes; \ +/var/lib/jvm/dev/classes-extra1; \ +/var/lib/jvm/dev/classes-extra2; \ +/var/lib/jvm/dev/classes-extra3; \ +/var/lib/jvm/dev/classes-extra4; \ +/var/lib/jvm/dev/classes-extra5; \ +/var/lib/jvm/dev/classes-extra6; \ +/var/lib/jvm/dev/classes-extra7 # Watch for changes in a directory (resources only). If not set, changes of resources won't be observed. # @@ -19,7 +26,14 @@ extraClasspath=/var/lib/jvm/dev/classes # replacements of resources in a building step (maven filtering resource option). # This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified # in src/main/resources, the new changed resource is served instead. -watchResources=/var/lib/jvm/dev/classes +watchResources=/var/lib/jvm/dev/classes; \ +/var/lib/jvm/dev/classes-extra1; \ +/var/lib/jvm/dev/classes-extra2; \ +/var/lib/jvm/dev/classes-extra3; \ +/var/lib/jvm/dev/classes-extra4; \ +/var/lib/jvm/dev/classes-extra5; \ +/var/lib/jvm/dev/classes-extra6; \ +/var/lib/jvm/dev/classes-extra7 # Load static web resources from different directory. #