Skip to content

An sbt plugin that allows your code to auto-update on re-compile using spring-loaded

License

Notifications You must be signed in to change notification settings

kbrowder/sbt-spring-loaded

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This plugin allows your to start processes using the spring-loaded Java class reloading agent, a FOSS alternative to JRebel (albiet a somewhat limited alternative).

This has been minimally tested against spray and akka classes YMMV.

This is the authors first "from-scratch" sbt plugin, so please be gentle.

Installation

sbt-spring-loaded requires SBT >= 0.13.5 (for AutoPlugin). Add the following to your project/plugins.sbt:

addSbtPlugin("me.browder" % "sbt-spring-loaded" % "0.2.0")

Usage

Since this requires forking the jvm and we don't want to wait for the application to recompile there are special commands to run your code:

reStart
start the mainClass of your project using spring-loaded, all arguments are passed though to it.
reStop
stop a previous invocation of reStart
reList
list what projects that have reStart JVMs running

Typical use case:

reStart
~compile

When you change your source you'll get new compiles which spring-loaded will pick up.

By default version 0.2.0 and greater now uses the Concurrent Mark Sweep GC so that class unloading can be used. Otherwise classes are kept forever which can lead to OOM: PermGen when doing class reloading, esp. on JDK < 8 which pulls from a fixed PermGen pool. JDK 8 introduces a new Mataspace which can use all of your memory (reducing the occurence of the issue) You can override this behavior by doing the following in sbt:

set noClassUnloading := true

Or you can add the following after the plugin load in plugins.sbt:

noClassUnloading := true

Special Thanks

  • SBT
  • spray/sbt-revolver for inspiration (the command lines are similar, hope you don't mind)
  • spring-loaded - really really under apprecieted (at least by those outside of the Grails community)

TODO

  • Determine if it's possible to parameterize the spring-loaded dependency.
  • Better logging
  • Testing

Copyright and License

Released under GPLv3.

Copyright (C) 2014 Kevin Browder.

About

An sbt plugin that allows your code to auto-update on re-compile using spring-loaded

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages