我正在尝试install the one-jar sbt plugin,但收到以下错误:
sbt/project/plugins/plugins.sbt:5: error: not found: value addSbtPlugin
addSbtPlugin("com.github.retronym" % "sbt-onejar" % "0.6")
以下是我的sbt/build.sbt
文件的相关内容:
seq(com.github.retronym.SbtOneJar.oneJarSettings: _*)
name := "dsg_nlp"
version := "0.11"
scalaVersion := "2.9.1"
libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "1.6.1" % "test" )
libraryDependencies += "commons-lang" % "commons-lang" % "2.6"
traceLevel in run := 0
fork in run := true
javaOptions in run ++= Seq("-Xmx7G", "-agentlib:hprof=cpu=samples,depth=12", "-server", "-enableassertions")
scalacOptions ++= Seq("-optimize")
mainClass in (one-jar, Compile, packageBin) := Some("Test")
我的project/plugins/plugins.sbt
文件的内容:
resolvers += "retronym-releases" at "http://retronym.github.com/repo/releases"
resolvers += "retronym-snapshots" at "http://retronym.github.com/repo/snapshots"
addSbtPlugin("com.github.retronym" % "sbt-onejar" % "0.6")
答案 0 :(得分:3)
我建议对上面的代码进行以下更改:
libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "1.6.1" % "test" )
libraryDependencies += "commons-lang" % "commons-lang" % "2.6"
分为两行。
最后一行应为
mainClass in oneJar := Some("Test")
如果你想为oneJar-Plugin使用另一个mainClass
。如果它与编译范围中的相同。您也可以将其写为
mainClass in Compile := Some("Test")
但不指定两者。
您的项目目录结构应如下所示:
Project-Root /
|-- build.sbt
|-- project/plugins.sbt
sbt文件的实际名称并不重要,只需要以.sbt结尾。