安装onejar插件时找不到sbt值addSbtPlugin

发布于 2024-12-20 00:47:01 字数 1161 浏览 6 评论 0原文

我正在尝试 安装 one-jar sbt 插件 但出现以下错误:

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")

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")

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清引 2024-12-27 00:47:01

我建议对上面的代码进行以下更改:

  • 确保每行只有一个设置。所以分成

   libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "1.6.1" % "test" )

   libraryDependencies += "commons-lang" % "commons-lang" % "2.6"
   

两行。

  • 最后一行应为

    oneJar 中的 mainClass := Some("Test")

    如果您想为 oneJar-Plugin 使用另一个 mainClass。如果与编译范围内的相同。你也可以这样写

    编译中的mainClass := Some("Test")

    但不要同时指定两者。

您的项目目录结构应如下所示:

Project-Root /
 |-- build.sbt
 |-- project/plugins.sbt

sbt 文件的实际名称并不重要,它们只需以 .sbt 结尾即可。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文