sbt value not found addSbtPlugin when installing onejar plugin

你。 提交于 2019-12-08 12:41:44

问题


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 mainClass for the oneJar-Plugin. If it's the same as in the compile scope. You may as well write this as

    mainClass 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!