How to add sbteclipse plugin in eclipse

I am using sbt 0.13 and I would like to add the sbteclipse plugin so that eclipse will import my sbt project and I can easily write scala code. While searching the web I got a link. I read all the instructions to make the plugins.sbt file and the added plugin, but I'm confused by the need to download and after downloading this zip file, what should I do next, please.

Any suggestion?

+6
source share
4 answers

No need to download anything manually. Just follow the instructions for SBT 0.13 and above.

Add this to your plugins.sbt

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4") 

Launch the sbt shell and enter eclipse.

This automatically downloads the plugin and creates the eclipse project files for you.

Now you can simply import the project using the Import Projects Wizard in Eclipse.

You can find these instructions in the README file on github: https://github.com/typesafehub/sbteclipse/blob/master/README.md

+5
source

I followed the steps below to install sbt on my windows computer

  1. downloaded and unpacked sbt zip

  2. set the path in an environment variable

  3. launched sbt int cmd (it took some time to load some dependencies)

    On Windows, you will find the sbt folder in the folder of your user profile in the folder C: \ Users \ UserName.sbt \ 1.0

  4. If the plugins folder is not in the above directory, you can create it and also create the plugins.sbt file in this new folder (C: \ Users \ UserName.sbt \ 1.0 \ plugins)

  5. add below command / text to plugins.sbt and save it addSbtPlugin ("com.typesafe.sbteclipse"% "sbteclipse-plugin"% "5.2.4")

  6. now when you run the sbt command in cmd you can type> eclipse so that it automatically loads

0
source

To create an Eclipse project definition, include the plugin dependency in PROJECT_DIR / project / plugins.sbt.

 addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.1.0") 

Add source and javadoc files to your build.sbt

 EclipseKeys.withSource := true EclipseKeys.withJavadoc := true 

In Intellij, just use the Intellij Scala plugin enter image description here

0
source

Eclipse does not have sbt plugin

although sbt has an Eclipse plugin

this is a workaround, but not the right solution.

this means that eclipse does not understand build.sbt, as it does for pom.xml or build.gradle, so if we change the dependency in our eclipse project in the build.sbt file, eclipse will not understand it and will not change the dependency in the dependency project . So you should take the following steps every time you change any dependency.

The workaround is as follows

Step 1: Download and install sbt from https://www.scala-sbt.org/release/docs/Setup.html for Windows, it's quite simple https://piccolo.link/sbt-1.2.8.msi is pretty simple forward

Step 2. Create a folder, say D: \ sbt \ edge. Now create the build.sbt file here. You can use the following as content, modify it accordingly.

 name := "edge" version := "0.1" scalaVersion := "2.11.8" val sparkVersion="2.4.0" libraryDependencies ++= Seq( "org.apache.spark" %% "spark-core" % sparkVersion, "org.apache.spark" %% "spark-sql" % sparkVersion, "org.apache.spark" %% "spark-mllib" % sparkVersion % "runtime", "org.apache.spark" %% "spark-streaming" % sparkVersion % "provided", "org.apache.spark" %% "spark-hive" % sparkVersion % "provided", "org.apache.spark" %% "spark-catalyst" % sparkVersion % Test, "org.apache.spark" %% "spark-graphx" % sparkVersion, "org.apache.spark" %% "spark-repl" % sparkVersion % "provided", "org.apache.spark" %% "spark-yarn" % sparkVersion, "org.apache.spark" %% "spark-mllib-local" % sparkVersion, //"org.apache.spark" %% "spark-streaming-kafka" % "1.6.3", //"org.apache.spark" %% "spark-streaming-twitter" % "1.6.3", "ch.qos.logback" % "logback-classic" % "1.1.3" ) 

Now create these subfolders src and main as → D: \ sbt \ spark \ src \ main

Step 3: Open CMD / PowerShell, go to D: \ sbt \ edge and run the "sbt package"

Step 4: Go to .sbt in your home directory and to the plugins folder of the correct version in my case C: \ Users \ xxxx.sbt \ 1.0 \ plugins, if you already have the plugins.sbt file, add the following line addSbtPlugin ("com .typesafe.sbteclipse "%" sbteclipse-plugin "%" 5.2.4 "), if not, create and add a line.

Step 5: Return to CMD / PowerShell, run sbt eclipse. This will create the necessary files for the eclipse project. Step 6. Open the Eclipse workspace and import this project as existing.

0
source

Source: https://habr.com/ru/post/1203215/


All Articles