Git Product home page Git Product logo

sbt-jrebel-plugin's Introduction

sbt-jrebel-plugin

Introduction

sbt-jrebel-plugin is a plugin for Simple Build Tool that generates configuration files (rebel.xml) for JRebel. A rebel.xml is not always required but is recommended because if you don't have one, JRebel cannot understand the layout of your project and might fail to reload changes. You also cannot reload changes from separate projects.

Supported SBT versions: 0.13.x

Features

  • Generates rebel.xml, so it's similar to javarebel-maven-plugin in the Maven world
  • Cross-project change reloading

Default behaviour

  • Disables itself if SBT isn't run with JRebel agent enabled
  • Writes rebel.xml as a managed resource which is automatically added to classpath and artifacts

You should always disable sbt-jrebel-plugin when publishing artifacts somewhere else than locally. Otherwise your artifacts will include rebel.xml files

Usage

Make sure you run sbt with JRebel agent enabled

Add the plugin declaration to project/plugins.sbt:

addSbtPlugin("fi.gekkio.sbtplugins" % "sbt-jrebel-plugin" % "0.10.0")

Then include the plugin settings in your project definition:

seq(jrebelSettings: _*)

If you are using xsbt-web-plugin and want to reload web resources, also add this:

xsbt-web-plugin >= 2.0:

jrebel.webLinks += (sourceDirectory in Compile).value / "webapp"

(remove .value if using SBT <= 0.13.2)

xsbt-web-plugin >= 1.0:

jrebel.webLinks <++= webappSrc in webapp

xsbt-web-plugin <= 0.9:

jrebel.webLinks <++= webappResources in Compile

How do I ...?

Disable rebel.xml generation

Project definition: jrebel.enabled := false

or in SBT console: set jrebel.enabled := false

Force rebel.xml generation (regardless of whether you run SBT with JRebel enabled)

Project definition: jrebel.enabled := true

or in SBT console: set jrebel.enabled := true

Cross-project change reloading

Let's say you have two projects, MyLib which is a library project and MyWebApp which is a webapp. These two are completely separate and differently versioned projects. If you have sbt-jrebel-plugin enabled for both projects, you can make changes in MyLib while developing MyWebApp and have them reloaded instantly.

  • Deploy MyLib with sbt publish-local. The package includes a rebel.xml file that contains the absolute paths to your MyLib project directories.
  • Update MyWebApp dependencies with sbt update. MyWebApp now uses the MyLib package that has a rebel.xml.
  • Run MyWebApp and enable continuous webapp compilation (for example I use sbt jetty-run "~ prepare-webapp")
  • In a separate terminal, start continuous compilation for MyLib (for example, sbt ~ compile).
  • Change a class in MyLib
  • Notice that the change is visible in MyWebApp (if the change is reloadable using JRebel). Voilá!

Do not share rebel.xml files because by default they contain absolute paths which are computer-specific!

TODO

Nothing at the moment! Please report any bugs you might find

sbt-jrebel-plugin's People

Contributors

csaltos avatar earldouglas avatar gekkio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sbt-jrebel-plugin's Issues

xsbt-web webapp reloading instructions

Hi, according to readme, jrebel.webLinks <++= webappSrc in webapp should be used to enable webapp resource reloading. I tried it and it fails on sbt 0.13.5 because jrebel.webLinks is a settings key and webappSrc is a task key. According to sbt docs:

a setting key can't depend on a task key

What worked for me is:

jrebel.webLinks += (target in Compile).value / "webapp"

change location of generated rebel.xml

I'm not entirely sure how to take advantage of the rebel.xml generated at target/scala-2.11/resource_managed/main/rebel.xml but the way I use JRebel with my project is that I generate a start script in target/start and then programmatically modify it to include -javaagent:... to activate JRebel. This unfortunately does not pick up rebel.xml from where sbt-jrebel-plugin puts it and instead I need to manually move it to project root.

Is there a way to set jrebelRebelXml or equivalent to change the output path of the generated rebel.xml file? If not, could one be added?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.