Test mode resources

32 views
Skip to first unread message

Phuong Nguyen

unread,
Nov 6, 2010, 6:32:08 AM11/6/10
to simple-build-tool
I have specify my database name in "cx.properties" and put it in "src/
main/resources/"
The problem is during test mode, I need to drop all tables in the
database. I'd like to leave the development database safe by putting
another "cx.properties" in "src/test/resources". However, such
solution works sometime and not the other time. Right now, I switch to
another machine (Ubuntu 10.10) and it doesn't work: My development
database tables dropped everytime I run the test.
Is there any specific things that I should notice when trying to
override some settings during test mode?

Mark Harrah

unread,
Nov 8, 2010, 8:54:13 AM11/8/10
to simple-b...@googlegroups.com

It is better not to rely on classpath ordering. Remove any paths from the classpath that you don't need, such as src/main/resources/cx.properties.

override def testResources = super.testResources --- (mainResourcesPath / "cx.properties")

-Mark

Jem

unread,
Jan 12, 2011, 7:48:45 PM1/12/11
to simple-b...@googlegroups.com
I consider this tactic (overwriting prod-time config with test-time variants) as pretty standard. Why shouldn't SBT ensure test resources are always preceding the standard resources?


--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.


Gustavo Hexsel

unread,
Jan 13, 2011, 1:16:54 PM1/13/11
to simple-b...@googlegroups.com
  I agree, to me this is a bug.  We use it all the time in Maven, there are a dozen spring files, but you want to overwrite the one with the database config or the email server or such.

drwho

unread,
Feb 9, 2011, 5:15:31 AM2/9/11
to simple-b...@googlegroups.com
test resources should definitely go before standard resources — was a bit surprised to learn that sbt is not doing that.

Alon Lavi

unread,
Feb 2, 2014, 12:34:05 PM2/2/14
to simple-b...@googlegroups.com
Hi,
Do somebody know if it is solved in the latest versions? 
Reply all
Reply to author
Forward
0 new messages