5

The Problem/s:

  • Views are being compiled but hitting refresh in a browser won't show the changes without restarting the server manually.
  • Changes to controllers compile automatically using ~run but only a manual server restart will update the content on the server.
  • Changes to routes under conf are only shown after manually restarting the server.

Background:

  • running on OSX 10.8.3
  • using Eclipse Juno 4.2.2
  • Server is launched using play ~run
  • Only restarting the server will show changes to views, controllers, routes

To be able to make changes without having to restart the server each time I tried (without success):

  • in the console: clean -> eclipse -> ~run
  • in the console: clean -> compile -> ~run
  • shutdown/restart the computer
  • Tick Refresh using native hooks or polling -> remove classes_managed from Referenced Libraries and add it manually

Questions:

  • How can the Auto-Reload functionality be restored?
  • How can this problem be solved on IDEs besides Eclipse?

Further information:

Both of them point to JNotify as the cause for auto-reloading not to work. One of the answers (not enough rep to write a comment) mentions how one could "hack Play framework's sbt plugin to make the PlayReloader trait behave as if JNotify wasn't available." How could one achieve this?

Community
  • 1
  • 1
schmittsfn
  • 1,412
  • 18
  • 40
  • Have you followed the instructions in this http://scala-ide.org/docs/tutorials/play20scalaide20/ – smk Mar 29 '13 at 18:36
  • I followed the instructions but no success. The source code is actually updated -- the managed scala equivalent shows the changes -- but the server isn't. – schmittsfn Mar 29 '13 at 19:16
  • Just checked and my views are listed when typing: `show watch-sources` in the console – schmittsfn Mar 30 '13 at 01:05
  • Currently investigating: http://stackoverflow.com/questions/10226919/reload-app-on-custom-file-change-in-playframework – schmittsfn Mar 30 '13 at 01:06
  • 2
    If you are using Eclipse try to disable the automatic build, maybe is interfering with the play! code generation. – alfonso.kim Mar 30 '13 at 18:36
  • 1
    I'm not using Eclipse. Anyone has another hint how to solve this problem? – adelarsq May 04 '13 at 23:54

3 Answers3

2

The following got Play's auto-reload to working with Eclipse:

  1. In Eclipse Preferences go to GeneralWorkspace. Uncheck Build automatically.
  2. Restart OS X.

For whatever reason, I had to restart OS X to get akim's suggestion to take hold.

Eric Silva
  • 101
  • 4
1

I got around this problem by changing the project configuration in Eclipse. I unchecked the "Allow output folders for source folders" option, which means that Eclipse will compile classes to the "bin" folder. This prevents the Eclipse compilation from interfering with the Play compilation. The only downside is that you have to remember to redo it if you ever do play eclipse again.

Nathan
  • 1,418
  • 16
  • 32
0

Following akim's suggestion, disabling Build automatically under General\Workspace in the Eclipse Preferences solves the problem and re-enables Play!'s auto-reload functionality in all of the above problem cases.

schmittsfn
  • 1,412
  • 18
  • 40