JaveRebel Setup

2 views
Skip to first unread message

Mark Lynn

unread,
Jun 22, 2009, 10:13:34 AM6/22/09
to lif...@googlegroups.com

I saw JavaRebel mentioned on the list in recent days and was excited
to try it. I followed the instructions at

http://wiki.liftweb.net/index.php/JavaRebel

for using it with Jetty. I have mvn scala:cc setup in another terminal
window and I see that it is compiling files that change. I also see
where JavaRebel is reporting that snippets are being reloaded, but it
does not appear to be reloading other classes generated from the
snippet source file. As an example, if I add a case to the dispatch
method, it does not pick up this change. Is this a limitation of
JavaRebel or am I missing something in the configuration? By the way,
I am not using an IDE - just Textmate and the command line which is my
preferred mode. The one thing I was really missing from the Rails
world was the reloading of classes automatically - hence I was very
excited to learn of JavaRebel.

- Mark

Mark Lynn
Sabado Technologies

fan...@gmail.com

unread,
Jun 22, 2009, 11:20:39 AM6/22/09
to lif...@googlegroups.com
Mark Lynn a écrit :

>
> I saw JavaRebel mentioned on the list in recent days and was excited
> to try it. I followed the instructions at
>
> http://wiki.liftweb.net/index.php/JavaRebel
>
[...] The one thing I was really missing from the Rails

> world was the reloading of classes automatically - hence I was very
> excited to learn of JavaRebel.

Hello Mark,

For the auto-reloading part, in webdevelopment, it's a MUST HAVE, so I
fully understand it :)

For the behaviour you are seeing, I have it, too, within IntelliJ: only
some classes are recompiled/reloaded. Particularly, anonymous classes
generated for higher order function and the like are not well handled.
So, I can't help you, but if you find a solution, I'm interested !

--
Francois Armand
http://fanf42.blogspot.com

David Pollak

unread,
Jun 22, 2009, 2:07:58 PM6/22/09
to lif...@googlegroups.com
Mark,

Anything that's passed to Lift in Boot is "static" and changes will not be picked up by JR on recompile.  So, if you're changing SiteMap or REST handling, you'll have to restart you app.

Thanks,

David
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

Mark Lynn

unread,
Jun 22, 2009, 2:54:10 PM6/22/09
to lif...@googlegroups.com

David,

Thanks. I expected that much, but I am only changing things within snippets. I see in the terminal window running mvn scala:cc that the file is being recompiled and I can also see in the file system that the corresponding class files have updated timestamps. However, JavaRebal only indicates that it is reloading the main snippet class file and does not appear to reload additional class files.

As an example, I defined MyMenu.scala as a direct replacement for Menu.scala so that I could add some wrapper html for menu items. I have the following (minus imports):

class MyMenu extends DispatchSnippet {
  def dispatch: DispatchIt = {
    case "item" => item
  }
 
  def item(text: NodeSeq): NodeSeq =
    for (name <- S.attr("name").toList;
         request <- S.request.toList;
         loc <- request.location.toList)
    yield {
      if (loc.name != name) {
        val itemLink = SiteMap.buildLink(name, text) match {
          case e : Elem => e % S.prefixedAttrsToMetaData("a")
          case x => x
        }
        <span class="link">{ Group(itemLink) }</span>
      } else if (S.attr("donthide").isDefined) {
        // Use the provided text if it's non-empty, otherwise, default to Loc's LinkText
        <span class="current">{
          if (text.length > 0) {
            Group(text)
          } else {
            Group(loc.linkText openOr Text(loc.name))
          }
        }</span>
      } else {
        Text("")
      }
    }


If I change the line

<span class="link">{ Group(itemLink) }</span>

to

<span class="test-link">{ Group(itemLink) }</span>

it does not pick this up though I see the following message in my console window:

JavaRebel: Reloading class 'org.watertogether.snippet.MyMenu'.

If I kill Jetty and restart it, then the change is found.

 - Mark

Mark Lynn
Sabado Technologies


David Pollak

unread,
Jun 22, 2009, 4:29:47 PM6/22/09
to lif...@googlegroups.com
Yeah... I updated to JR 2.0.1 and am seeing the same problems.  It's looking like JR is not loading the anonymous inner classes that Scala generates.  I'd suggest reporting this on the JavaRebel list.

Sorry.

Mark Lynn

unread,
Jun 22, 2009, 4:43:41 PM6/22/09
to lif...@googlegroups.com

For future reference, posted to JavaRebel support forum at


Mark Lynn
Sabado Technologies



Reply all
Reply to author
Forward
0 new messages