How to continuously deploy changes in JSF project without restarting Tomcat?

后端 未结 2 1130
醉梦人生
醉梦人生 2021-01-27 01:45

I have a JSF project in Eclipse. Now every time I make changes to the .xhtml files, I have to stop Tomcat server, and then start Tomcat server again. Is there any o

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-27 01:59

    There are at least two changes you need to make when you need to develop a JSF project:

    1. Tell Eclipse to automatically publish changes by changing the Tomcat settings as follows (doubleclick Tomcat server entry in Servers view to get this screen):

      enter image description here

      It namely defaults to "Never publish automatically".


    2. Tell JSF that the webapp is currently in development mode by adding the following to web.xml:

      
          javax.faces.PROJECT_STAGE
          Development
      
      

      This will change some internal workings to make the developers easier such as disabling the Facelet cache and reloading resources. Don't forget to remove this when building a production release because this affects performance. This setting can alternatively also be set by JNDI.


    The alternative is to migrate from the barebones Tomcat server to a normal JEE server such as WildFly, Payara, Liberty, etc. For them, the above described Eclipse setting is not necessary anymore and you can even live edit bean methods (on Tomcat, you'd still need to restart the whole server for them).

提交回复
热议问题