Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the directory into which SBT puts test resources?

I want the test-compile action to put the contents of src/test/resources into target/scala_2.8.1/test-classes.

The reason for this is that I'm running SBT with IntelliJ IDEA, which puts the test-classes directory on the classpath when it runs tests.

My logback-test.xml file (configuration for logback logging framework) lives in src/test/resources, and it's not being found during testing.

like image 593
David Avatar asked Jan 21 '11 03:01

David


1 Answers

This doesn't directly answer your question, but instead shows an the alternative that I use.

I add two new tasks: prepare and test-prepare.

lazy val prepare = task{
  None
} dependsOn (compile, copyResources) describedAs ("Compiles main, copies main resources. Use for the before-action in the idea-sbt-plugin")

lazy val testPrepare = task{
  None
} dependsOn (testCompile, copyResources, copyTestResources) describedAs ("Compiles main and test, copies all resources. Use for the before-action in the idea-sbt-plugin")

I then configure the 'before run' SBT action to these. This requires the idea-sbt-plugin.

alt text

I use the sbt-idea SBT Processor to configure the IntelliJ module setup. This includes target/scala_2.8.1/[test-]resources as a dependency.

alt text

like image 67
retronym Avatar answered Nov 15 '22 03:11

retronym