我的project/build.sbt
:
libraryDependencies += "com.typesafe" % "config" % "1.2.1"
我的application.properties
(在项目根目录):
key=value
我的根build.sbt
:
import com.typesafe.config.ConfigFactory
val projectName = "ai"
name := projectName
val projectVersion = "1.0.0"
version := projectVersion
scalaVersion := "2.11.7"
libraryDependencies ++= List(
"org.scala-lang" % "scala-swing" % "2.11.0-M7",
"org.reflections" % "reflections" % "0.9.10",
"io.reactivex" % "rxscala_2.11" % "0.25.0",
"com.github.tototoshi" %% "scala-csv" % "1.2.2",
"com.jsuereth" %% "scala-arm" % "1.4"
)
val conf = ConfigFactory.load()
assemblyOutputPath in assembly := new File(s"target/${conf.getString("key")}-$projectVersion.jar")
当我在SBT控制台中运行assembly
时,我得到[error] (*:assembly::assemblyOutputPath) com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'key'
答案 0 :(得分:-1)
你把key = value放在application.conf中吗?只需在application.conf中定义键,因为它在application.conf中搜索key的值 比如示例
key="file_name"