我有一个这样的目录结构:
CSV_generator
src
main
scala
CSVGenerator.scala
project
plugins.sbt
我的 scala 对象的内容是这样的:
package tools.csv_generator
object CSV_Generator{
import java.nio.file.{Paths, Files}
import java.io.File
import org.rogach.scallop._
def main(args: Array[String]){
val opts = new ScallopConf(args) {
banner("""This is the program CSV Generator""")
val file_path = opt[String]("file_path",
required = true,
descr = "File Path")
val dome_string = opt[String]("dome_string",
required = true,
descr = "Dome String")
}
我的 csv_generator/project/plugins.sbt:
addSbtPlugin("com.typesafe.sbt" % "sbt-proguard" % "0.2.2")
我的 csv_generator/build.sbt 是:
proguardSettings
ProguardKeys.options in Proguard ++= Seq("-dontnote", "-dontwarn", "-ignorewarnings"
, "-keepclasseswithmembers class scala.CSV_Generator")
ProguardKeys.options in Proguard += ProguardOptions.keepMain("src.main.scala.CSV_Generator")
在我的 sbt 中,当我proguard:proguard
尝试将所有代码打包到一个可运行的独立 jar 文件中时,我得到了这个:
[error] Error: The output jar is empty. Did you specify the proper '-keep' options?
[trace] Stack trace suppressed: run last proguard:proguard for the full output.
[error] (proguard:proguard) Proguard failed with exit code [1]
[error] Total time: 14 s, completed Jan 31, 2014 12:18:38 AM
对于像我这样的小应用程序,proguard 的例子很少。有人可以帮忙吗?