0

I am trying to configure gretty in a way which will allow me to reload static resources like *.html files (which lives inside standard src/webapp/WEB-INF) without server redeploy. However all my attempts were unsuccessful.
I test it by changing html file and reload html page with clear cache inside chrome(ctr+shift+R).

With Configuration 1:

gretty {
  contextPath = 'john'
  servletContainer = 'jetty9'
  fastReload = true
}

Changing of any html page has no effect at all.

With Configuration 2:

gretty {
  contextPath = 'john'
  servletContainer = 'jetty9'
  fastReload = false
}

Changing of any html calls whole server redeploying which I do not want to happen.

Any chance to make this working?

Oleg Baranenko
  • 398
  • 2
  • 16

1 Answers1

1

As stated in the official documentation, Gretty's fast reload handels changes for files and folders located under the src/main/webapp directory. For the path src/webapp/WEB-INF fast reload is not enabled.

Either you have to move the webapp folder to comply with the path requirements or you add the folder to the fast reload feature specifically. The functions fastReload(String) and fastReload(java.io.File) allow you to specify directories and files for fast reload.

UnlikePluto
  • 3,101
  • 4
  • 23
  • 33
  • I've tried and fastReload = 'src/webapp/WEB-INF' but it cause server reload when I change any resource inside WEB-INF folder – Oleg Baranenko Nov 08 '18 at 17:48
  • Are you running your application inplace, using `appRun` or as a war task, via `appRunWar`? – UnlikePluto Nov 09 '18 at 07:39
  • I run it via gradle task. Gretty -> jettyStart – Oleg Baranenko Nov 09 '18 at 20:02
  • I've tried AppRun task. I can see from task output that prepareInplaceWebAppClasses had been called. But changing of resource inside webapp folder does not reflected in web browser :( – Oleg Baranenko Nov 09 '18 at 20:23
  • 1
    To be able to use fastReload, you have to run your application in inplace mode using ´appRun´. You can't find this in the official documentation but in Gretty's source code. – UnlikePluto Nov 09 '18 at 22:33
  • 1
    Please add your custom webapp folder to Gretty's `extraResourceBase`. You don't need to add your folder to the fastReload feature using `fastReload(java.io.File)` this way. Check here: https://gretty-gradle-plugin.github.io/gretty-doc/Web-app-extra-resource-bases.html – UnlikePluto Nov 09 '18 at 22:57
  • Sorry, extraResourceBase did not help – Oleg Baranenko Nov 10 '18 at 13:46