问题
I'm trying to install the one-jar sbt plugin but am getting the following error:
sbt/project/plugins/plugins.sbt:5: error: not found: value addSbtPlugin
addSbtPlugin("com.github.retronym" % "sbt-onejar" % "0.6")
Here is the relevant contents of my sbt/build.sbt file:
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")
And the contents of my project/plugins/plugins.sbt file:
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")
回答1:
I would suggest the following changes to the code above:
- Make sure you have only one setting per line. So split
libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "1.6.1" % "test" )
libraryDependencies += "commons-lang" % "commons-lang" % "2.6"
into two lines.
The last line should read
mainClass in oneJar := Some("Test")if you want to use another
mainClassfor the oneJar-Plugin. If it's the same as in the compile scope. You may as well write this asmainClass in Compile := Some("Test")but do not specifiy both.
Your project directory structure should look like this:
Project-Root /
|-- build.sbt
|-- project/plugins.sbt
the actual names of the sbt-files don't matter they just have to end in .sbt.
来源:https://stackoverflow.com/questions/8407322/sbt-value-not-found-addsbtplugin-when-installing-onejar-plugin