I am trying to pass command line arguments to my JAR created with sbt-assembly
. Neither of these -Dconfig.file=application.conf
nor -Dconfig.trace=loads
My exact command is
java -jar googleScraper-assembly-0.0.1.jar -Dconfig.trace=loads -Dconfig.resource=application.conf
This is my build.sbt
lazy val googleScraper = project.in(file("google-data-scraper"))
.settings(commonSettings:_*)
.settings(
version := "0.0.1",
assemblyMergeStrategy in assembly := {
case m if m.toLowerCase.endsWith("manifest.mf") => MergeStrategy.discard
case m if m.toLowerCase.matches("meta-inf.*\\.sf$") => MergeStrategy.discard
case "log4j.properties" => MergeStrategy.discard
case m if m.toLowerCase.startsWith("meta-inf/services/") => MergeStrategy.filterDistinctLines
case "reference.conf" => MergeStrategy.concat
case "application.conf" => MergeStrategy.concat
case _ => MergeStrategy.first
},
libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.3.0",
"com.typesafe.play" % "play_2.11" % "2.3.9",
"com.typesafe.play" % "play-ws_2.11" % "2.3.9",
"com.ning" % "async-http-client" % "1.8.15"
),
fork in run := true
)
.dependsOn("util")
.dependsOn("core")
Edit
So turns out that putting the argument before the -jar makes a different. This now works:
java -Dconfig.trace=loads -Dconfig.resource=blah.conf -jar googleScraper-assembly-0.0.1.jar
but it now the loading indicates that the app is trying to load the new config from within the JAR. How can I make it load it completely externally (absolute path didn't work)?