I thought JRebel should be able to reload any class if a dependent
class is reloaded? i.e. the class of the template should be
automatically reloaded by JRebel.
Maybe its because the classes for the templates are generated in a
different directory to the other classes. e.g. in the sample maven web
app projects in Scalate (e.g. scalate/samples/scalate-sample/) we
specify the scalate.workdir system property to be "target/_scalate" so
that the generated classes go into "target/_scalate/classes". I wonder
if you add that directory to the list of directories that JRebel
monitors, it'll correctly reload the class for the template if its
dependencies change?
Failing that we might need a JRebel plugin for Scalate - but I would
have hoped JRebel is capable of figuring out class changes & reloading
properly.
--
James
-------
FuseSource
Email: ja...@fusesource.com
Web: http://fusesource.com
Twitter: jstrachan
Blog: http://macstrac.blogspot.com/
Open Source Integration
So we probably need a JRebel plugin for scalate. I guess there is one
for JSP already?
BTW dev mode shows the Scalate console which also has a "Clear Cache"
option to flush the template cache without restarting Jetty.
http://scalate.fusesource.org/documentation/console.html
I've created a Scalate JRebel plugin in master. Just add
scalate-jrebel to your classpath then it gets notified when JRebel
reloads a class; it then flushes all the cached compiled templates so
that they are all reloaded properly.
If using the maven build in Scalate (and assuming JREBEL_HOME
environment variable points to your jrebel install), you can do
cd samples/scalate-sample
./run -Pjrebel
to run the sample in JRebel reloading mode with scalate-jrebel
enabled. If in another shell you type
cd samples/scalate-sample
mvn scala:cc
Then start hacking the scala code, you should see Scalate log that its
flushing its caches.
The current scalate-jrebel plugin is pretty pessimistic; it flushes
all compiled templates when any class reloads in JRebel.
Ideally the more optimal solution would be for JRebel to be aware of
the Scalate class loader and directory of src and classes so that only
required templates should be reloaded.
Maybe another more optimal solution could be to detect which Scalate
templates are affected by JRebel class changes using JRebel APIs?
However at least the basics should work; if you change some code and
JRebel reloads it, you won't have to restart Jetty.
On 11 March 2011 09:51, James Strachan <ja...@fusesource.com> wrote:
Remember you've always the Scalate console as a workaround until you
figure out your configuration & enviromment; you just need to set the
"scalate.mode" system property to "dev" when running Jetty.
2011/3/14 Freewind <nowi...@gmail.com>: