Load .conf file in .scala build definition

345 views Asked by At

I'm trying to load a configuration file from project/distribution.conf into my .scala build definition setting through typesafe config library, although this file exists, this library fails to load it:

distributionFile <<= (baseDirectory in ThisBuild)(_ / "project" / "distribution.conf")

throw ConfigException. But other file version.properties was loaded perfectly, although i work with it manually.

1

There are 1 answers

0
4lex1v On

Ok i've solved the problem. ConfigFactory.load(path) was expecting a relative path, but i coundn't find any method on File which could return it. But in ConfigFactory there is another method parseFile which expects a File, so setting is very easy:

distributionFile <<= (baseDirectory in ThisBuild)(_ / "project" / "distribution.conf"),
distributionConf := ConfigFactory.parseFile(distributionFile.value)