Reputation: 661
I have a Scala project with numerous dependencies. One of them requires a setting which is not in its own application.conf, but in other dependency's application.conf. When I run the project with sbt run
everything is fine, however, when I run a packaged deb service or a bin script from target/universal/stage/bin, I get an error: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'roadmaps'
. Two dependencies have this setting in application.conf inside their jars. When I moved the setting from application.conf into reference.conf and re-published the dependency, then re-packaged my project, the packaged version worked.
So why is my setting not picked up from application.conf in dependency's jar and why exactly should I keep library configuration in reference.conf, aside from the fact that it has lowest precedence among config files?
Upvotes: 0
Views: 203
Reputation: 661
-Dconfig.trace=loads
helped me find an answer. When I sbt run
a project that dependsOn
other projects, it loads first its own application.conf
, then those packaged in jars of its direct dependencies (this is where 'roadmaps'
setting comes from), then reference.conf
s of the dependencies. When I add bashScriptExtraDefines += """addJava "-Dconfig.file=${app_home}/../conf/application.conf""""
into build.sbt, package the project with stage
and run it from the script in target/universal/stage/bin
, it only loads the specified application.conf
and then proceeds to reference.conf
s.
Upvotes: 2