When I go to the Glassfish 4.x admin frontend and use the path to the unpackaged Eclipse build folder instead of uploading a WAR file, a simple "touch .reload" will trigger a relatively fast reload of the webapp container. However, when using the Eclipse plugin for Glassfish, the entire app gets packaged into a war and deployed after updating some class, which seems to be a really stupid thing to do during development.
Is there any possibility to make the .reload mechanism work in Eclipse?
From the command line, this can be done via
./asadmin redeploy --name jersey-war-example-1
which even eliminates the polling. Now I need to somehow turn this into an Eclipse build extension that does not start up a java instance just for that.
If the current platform supports inotify, one can hook it up to the Glassfish RESTful API to trigger deployment reload on any changes:
One just has to make sure that updated class files get written to the correct folder. When using maven, add this to pom.xml:
That way not even the polling mechanism and its implicit delay is needed, no JVM startup for the admin CLI either. The same is possible for WildFly 11. A BASH script doing this for both servers is available at https://gist.github.com/jjYBdx4IL/55334bc09e635c6e8d7a2fa30b2919ef.