GlassFish Auto Deployment and Hot Deployment
There are several ways to deploy a GlassFish application. To speed up development/debuging we need a way to instantly deploy web applications. One of the ways is to use hot deployment feature, another lesser known feature is ‘directory deployment’. You simply point GlassFish to your development directory and let it pick up and deploy application from there. No packaging and re-deoploying hassles. The catch is whenever you want to re-deploy your application you just need to ‘touch’ a file called ‘.reload’ which should be present in your web folder.
Following is the command and directory structure you can use.
–|myproj
–|–|src
–|–|web
–|–|–|WEB-INF
–|–|–|–lib
–|–|–|–classes
–|–|–|–web.xml
–|–|.reload
GLASS_FISH_HOME/bin/asadmin deploydir full_path_to_you_web_folder
If you are using Eclipse or NetBeans make sure that they put the class files in web-inf/class folder after compiling.
November 18th, 2007 at 11:17 am
Thanks for this greate tip! I am tired of Eclipse’s auto redeploying, and I lookup this tip for two days!
In my practice, dir structure should like this:
–|myproj
–|–web
–|– …
–|–WEB-INF
–|–|–lib
–|–|–classes
–|–|–web.xml
–|–|–sun-web.xml
–.reload
note: in sun-web.xml, you can define custom context name like this(otherwise the dir name become context name):
November 18th, 2007 at 11:19 am
content of sun-web.xml:
/seamsample2
March 10th, 2008 at 11:26 am
In windows, how to “touch” a file?
How to make NetBeans touch the file automaticly after some .java files are changed?