安装onejar插件时找不到addSbtPlugin的sbt值 [英] sbt value not found addSbtPlugin when installing onejar plugin
问题描述
我正在尝试安装one-jar sbt插件但收到以下错误:
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")
这是我的 sbt / build.sbt
文件的相关内容:
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")
我的项目/ 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")
推荐答案
我建议对上面的代码进行以下更改:
I would suggest the following changes to the code above:
- 确保每行只有一个设置。所以拆分
libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "1.6.1" % "test" )
libraryDependencies += "commons-lang" % "commons-lang" % "2.6"
分为两行。
-
最后一行应该读取
The last line should read
oneJar中的mainClass:= Some(Test)
如果你想为oneJar-Plugin使用另一个 mainClass
。如果它与编译范围中的相同。您也可以将此写为
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:= Some(Test)
但不指定两者。
您的项目目录结构应该看起来像这样:
Your project directory structure should look like this:
Project-Root /
|-- build.sbt
|-- project/plugins.sbt
sbt文件的实际名称无关紧要他们只需要结束.sbt。
the actual names of the sbt-files don't matter they just have to end in .sbt.
这篇关于安装onejar插件时找不到addSbtPlugin的sbt值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!