sbt - How to make properties file available to FileInputStream in Scala script? -


I have a scala script that I want to call with SBT. This scala script shows some reliance, one of which uses dependency property file. This property file is provided as the time to run because this dependency is run as a separate application.

Just to run that property is likely to use dependency as a dependency, I wrote this scala script which I want to call from Sbt.

  val fis = new FileInputStream ("my.properties") // here fails val props = new property ()   

When I click the code above I run it, it fails in my dependence with an exception where the properties file is loaded.

How is this property file made available in Scripts under SBT?

file my.properties in src / main / resources < / Code> and Source.fromURL (getClass.getResource ("/ my.properties")) instead (because it gives you more flexibility where you can keep the file on file system Until it's at CLASSPATH).

In the form of an assistant, use the following code to find out about the place where "bare" file * are in use: < pre println (new java.io.file ("my.properties"). GetAbsolutePath)

Since the current working directory is a top-level directory of a project, Code> $ PROJECT_ROOT_DIR / my.properties .

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -