问题
We are wondering how to setup GlassFish 3.1.2 real hot deployment, that is not just the usual setting
How can I hot deploy using the glassfish adapter in Eclipse
but how to make it possible that the Eclipse GlassFish plugin will silently push changed XHTML, CSS, etc. files to the server as you save the file in Eclipse.
How is it officially setup?
Again, I tested this several times now, hot-deploying just-changed XHTML(/JSF), CSS files on save just doesn't work.
When setting to Never publish automatically nothing happens when saving a JSF file. When setting to Automatically publish when resources change the whole webapp redeployment process is triggered (taking 30+ seconds!).
Q:
How is JSF, CSS hot deployment on save setup using Eclipse and the official GlassFish plugins pointed to a local, non-internal GlassFish 3.1.2?
Where do you have to look? Into the plugin or the local GF?
What makes the whole topic even more confusing is that some people get this to work easily, see http://www.java.net/forum/topic/glassfish/glassfish-plugins/glasfish-plugin#comment-819774
"just about any save of a non-java file will be visible 'immeditaely' when publish on save is active."
Not here!
It's odd... and important!
回答1:
There is 'hack' that I use and works fine with maven, eclipse & GF4 hot deployment. Navigate inside your workspace where you have you xhtml project. open .project file edit
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments></arguments>
</buildCommand>
Modify to:
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<triggers>incremental,</triggers>
<arguments></arguments>
</buildCommand>
It works just fine for, but it might cause weird build issues (haven't tried for a long time so can't really say so use with case.)
============== Another workaround that I tried but run into eclipse/maven bugs==========
I managed to get this to work with eclipse. The steps were the following:
- Double-click on glassfish->expand Publishing and make sure that you set Automatically publish when resources changes
- Right-click on the server ->Glassfish and make sure User Jar Archives fro Deployement is unchecked
- Then make sure you have Project-Build automatically deselected
From what I can tell maven is touching resources on save, so Glassfish restarts. Hope it helps
回答2:
If you have installed "Maven Integration for WTP" in your Eclipse, uninstall it (use m2e instead). Doing this, the hot-deployment of WebContent resources such as .xhtml and .css -files was reenabled to me. Unfortunately I don't know the reason for this workaround working.
Anyhow, I am also interested in your question of real hot-deployment (particularly of .java-files).
来源:https://stackoverflow.com/questions/12419636/glassfish-real-hot-deployment-of-jsf-pages-and-resources-css-etc-in-eclipse