如何将Scala库添加到Eclipse [英] How to add a scala library to eclipse

查看:360
本文介绍了如何将Scala库添加到Eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将此Scala库添加到Eclipse中,以便添加我可以使用的可用功能在演员上.

I am trying to add this Scala Library into Eclipse so as to add available functions I can use on Actors.

我已经下载了文件并解压缩,然后尝试将其添加到项目浏览器中的工作区中,但是当我尝试时,Eclipse告诉我在文件中找不到任何项目.我确定有一个教程或在线内容可以确切地解释如何执行此操作,但是就像我说的那样,我不确定所有术语,所以我不知道要搜索什么才能得到结果想要.

I've downloaded the file and extracted it and tried adding it to my workspace in the project explorer, but when I try, Eclipse tells me it can't find any projects in the file. I'm sure that there is a tutorial or something online that explains exactly how to do this, but like I said, I'm not sure about all the terminology, so I don't know what to search for to get the result I want.

推荐答案

最简单的方法是创建sbt项目并使用

The easiest way is to create an sbt project and use the sbteclipse plugin.

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

Your project structure should look like this:

build.sbt
project/build.properties
project/eclipse.sbt

build.sbt

(请注意,代码行应用白线分隔)

(note that lines of code should be separated by a white line)

name := "ProjectName"

libraryDependencies += "org.scala-lang.modules" %% "scala-async" % "0.9.2"

build.properties

sbt.version=0.13.5

eclipse.sbt

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

然后在根目录中执行sbt,并在sbt命令行中执行eclipseeclipse with-sources=true

Then from the root directory execute sbt and within the sbt command line execute eclipse or eclipse with-sources=true

您可以使用 sbt-extras

You can use sbt-extras or activator to get a specialized version that will automatically download the correct sbt version based on the build.properties file.

您可以添加sbteclipse插件作为默认插件,通过在~/.sbt/0.13/plugins目录而不是project目录

You could add the sbteclipse plugin as a default plugin, making it available in all projects by creating eclipse.sbt in the ~/.sbt/0.13/plugins directory instead of the project directory

这篇关于如何将Scala库添加到Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆