[Self-use] How to configure a downloaded sbt project in eclipse [Windows]

It is generally believed that the project folder contains the build.sbt file, which is the sbt project.

Take an open source sbt project on github as an example: https://github.com/chanhosuh/deeplearning

 

1. Basic software installation and configuration

Scala

Eclipse

Scala plugin for Eclipse (plugin)

 

2, sbt installation and configuration

To install on Windows platform, it is recommended to download the sbt.msi installation file.

Before running sbt after installation, you need to set environment variables and add the bin directory of sbt to PATH . After that, typing sbt anywhere in the DOS window will work.

After setting, open the DOS window (R + Win -> cmd), enter sbt , when running for the first time, sbt will download some jar packages online.

After the update, there will be a console input >, you can enter help , and a description of some parameter commands will be displayed.

 

3, sbt local warehouse settings

sbt uses ivy as a library management tool. By default, ivy builds the library repository under the user home.

The way to customize the location of the library local repository is:

Modify the sbt configuration file: [sbt installation directory]\conf\sbtconfig.txt;

add a line to the file

 

 -Dsbt.ivy.home=D:/dev/ivy/

 

[Use the dev/ivy folder under the D drive as a local repository.

 

4. Configuration of sbteclipse

sbteclipse is the sbt plug-in of eclipse, but the configuration and use of the general eclipse plug-in are not the same.

The source code of the sbteclipse project is hosted on github: https://github.com/typesafehub/sbteclipse .

全局插件定义在~/.sbt/0.13/plugins/plugins.sbt文件中。

【以上路径在Windows下默认存在于C盘中的用户文件夹中。】

局部插件定义在具体项目文件夹下 project/folder/plugins.sbt文件中。

plugins.sbt文件中的内容如下:

 

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

 

如果需要描述多个插件,则应保留不同设置语句之间一个空白行。

 

添加sbteclipse插件之后,在命令行中输入sbt,如果sbt已经启动则输入reload,等待系统自动解析并下载jar。此后,得到新的指令eclipse

 

5、sbteclipse的使用

下载github上的开源sbt项目,保存为zip文件并解压。在命令行中进入解压后的项目文件夹,依次输入sbtcompile,然后输入eclipse

执行成功后,命令行显示:

“[info] Successfully created Eclipse project files for project(s):…”

相应的,项目文件夹下新增 .project文件、.classpath文件、.settings/文件夹。

打开eclipse,将以上项目文件夹作为“General -> Existing Projects into Workspace”导入。

 

参考文章1:http://www.zihou.me/html/2013/03/14/8400.html

Reference article 2: http://my.oschina .NET /gczhang/blog/110421?fromerr=FdRgco2H

Reference article 3: http://www.cnblogs.com/rxingyue/p/4398591.html

For more information refer to: https://github.com/typesafehub/sbteclipse/wiki

http://blog.csdn.net/lixiaowang_327/article/details/51315316

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326692323&siteId=291194637