EzDevInfo.com

sbt-revolver

An SBT plugin for dangerously fast development turnaround in Scala

SBT with read-only base directory

I am experimenting with SBT Revolver within a Docker container. I am mounting the base directory as a Docker volume. It works great, except for one problem: Docker does not map users, so I'm ending up with project/project/ and project/target/ directories that are not owned by the host user.

I was able to relocate the target/ directory by adding this to the build.sbt in the base directory:

target := file("/data/target")

But I don't have a clue as to how to customize the location of the files created within the project/ directory.

Is it possible in any way to have an SBT build where all the build outputs are created outside the base directory?


Source: (StackOverflow)

How to run sbt Revolver in test scope?

In a Akka project we're using the SBT Revolver plugin to run the application. During development it would be useful if it would be possible to run the application in test scope so log- and application configuration get loaded which helps during development.

However, running 'sbt test:re-start' does not seems to use the test classpath and therefore does not run the correct application and does not use the correct configuration files.

Looking at the Revolver page it looks like the plugin creates it's own scope. Does anyone know how to be able to use the test scope for running the Revolver plugin?


Source: (StackOverflow)

Advertisements

Can I make sbt compile additional sources with additional dependencies only for a specific task?

I am using spray revolver to test my application while writting code.

I would like to make a revolver run compile additional sources (e.g. /src/dev.scala or whatever) with additional dependencies. This is so when testing locally I can startup some external sevices we are using (e.g. cassandra) in the same vm without the need to have a proper environment set up.

Initially I tried setting these settings like this:

unmanagedSources in Revolver.reStart <<= (unmanagedSources in Compile) map { ss => ss :+ new File("/path/to/my/dev.scala") }

libraryDependencies in Revolver.reStart += ("org.cassandraunit" % "cassandra-unit" % "2.0.2.1")

mainClass in Revolver.reStart := Some("my.main.class.in.dev")

But when running the task,I just get that the main class doesn't exist.

Is there any way to make this work? The idea is to avoid having the cassandra-unit and code in dev.scala out of the compilation for tests & packaging.


Source: (StackOverflow)

Custom resourceDirectory for Revolver/Spray

I have a Spray application with a basic front end component with source in src/main/frontend and the deployed version (compiled sass, minification etc.) in Spray's default resources location src/main/resources. I would like to change the resource directory to src/main/frontend for Revolver's re-start task only, in order to see changes quicker when developing.

I have tried adding the setting

resourceDirectory in Revolver.reStart <<= baseDirectory(_ / "src" / "main" / "frontend")

but it doesn't seem to have an effect. I guess because resourceDirectory is a setting in the Compile scope and not one in Revolver itself. In the SBT console:

> reStart:resourceDirectory
[info] /Users/cartew01/workspace/applaudio-spray/src/main/frontend
> compile:resourceDirectory
[info] /Users/cartew01/workspace/applaudio-spray/src/main/resources

Does anyone know how I can change this for the re-start task but not for any others? Possibly by creating a custom task that calls re-start with the additional setting?

Thank you for your help.


Source: (StackOverflow)

What is the simplest way to run sbt re-start before sbt it:test and sbt re-stop afterwards?

I need to do the following in sequential order.

  1. Start spray-can server (sbt re-start).
  2. Run integration tests (sbt it:test).
  3. Stop spray-can server (sbt re-stop).

Can't make it work with sbt-sequential plugin since Revolver.reStart is not a Task.


Source: (StackOverflow)