SBT beginner question : How to query property from project/build.properties ?

55 views
Skip to first unread message

Niko

unread,
Aug 18, 2013, 6:15:17 PM8/18/13
to simple-b...@googlegroups.com
Hello, 

A simple scala and sbt beginner question: how to get in the Build.scala  a property as a string  from project/build.properties file ?

For example I define a property:

jboss.home=/Users/nmajorov/tools/wildfly-8.1.0.Alpha4/

in the file project/build.properties 

How to get "jboss.home" property  in the Build.scala for my task ? 

I'm a bit lost in the sbt api..

Regards,
Niko

eugene yokota

unread,
Aug 18, 2013, 11:13:31 PM8/18/13
to simple-b...@googlegroups.com
Unless you're using sbt 0.7, project/build.properties file is not the place to store user-specific settings.
You should probably define a custom key for it in build.scala:

    val jbossHomePath = SettingKey[File]("jboss-home-path")

Then, make user.sbt:

    jbossHomePath := file("/Users/nmajorov/tools/wildfly-8.1.0.Alpha4/")

See [1] for extracting the value out of the key using <<=.

-eugene

Reply all
Reply to author
Forward
0 new messages