سؤال

i have problems top use sbteclipse

What I have done:

  • went to my global sbt folder.
  • created a plugins folder
  • created the file plugins.sbt with addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
  • went to my eclipse project and created a build.sbt file
  • it contains:

name := "foo"

version := "1.0"

scalaVersion := "2.9.2"

libraryDependencies += "net.java.dev.jna" % "jna" % "3.4.0"
  • I am selecting the project folder in my cmd. and type sbt eclipse

But I always get the following error

[error] Not a valid command: eclipse (similar: help, alias)
[error] Not a valid project ID: eclipse
[error] Expected ':'
[error] Not a valid key: eclipse (similar: deliver, licenses, clean)
[error] eclipse
[error]        ^

ps: I am using Windows. I am also using sbt 0.12

هل كانت مفيدة؟

المحلول

Your global sbt folder is at %USERPROFILE%\.sbt (C:\Users\<username>\.sbt most likely). So your plugins should be defined at %USERPROFILE%\.sbt\plugins\plugins.sbt

Failing this you can add it to your project directly. Add the file path is <project_root>\project\plugins.sbt. If the project directory doesn't exist you will need to create it.

نصائح أخرى

I think that I might have found a solution. First, the default directory checked for plugins configuration is 'USER_HOME/.sbt/plugins' and NOT 'USER_HOME/.sbt/0.13/plugins'.

Secondly, the sbt version specified seems to matter. In 'PROJECT_HOME/project/build.properties', there's an 'sbt.version' property. If the version of sbt specified in this file is different from the actually installed version of sbt, there's likely to be an issue. I think I was affected more so by this because I'm using an Activator template and it already had 'sbt.version' specified in this 'build.properties' file.

While nosing around, I came across this

"Support for plugin configuration in project/plugins/ has been removed. It was deprecated since 0.11.2" from sbt website at http://www.scala-sbt.org/0.13.0/docs/Community/ChangeSummary_0.13.0.html. I still see a lot of guys pointing that it should be configured in 'PROJECT_HOME/projects/plugins.sbt'. I think this is very confusing.

I had similar a issue and answered to a similar question.

I tried "everything" and, eventually, I just had to update my sbt from 0.13.1 to 0.13.9.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top