sbt筆記三 用IDEA和Eclipse開發sbt專案
阿新 • • 發佈:2019-01-01
首先把我們之前的專案hello-sbt複製兩份,分別叫hello-sbt-idea和hello-sbt-eclipse。
新增外掛
有兩個外掛可以把sbt專案轉換為idea專案和eclipse專案。 在hello-sbt-idea/project/下建立plugin.sbt檔案,內容為: ?1 2 |
addSbtPlugin( "com.github.mpeltonen"
%
"sbt-idea"
%
"1.5.2" )
//
2013/10/28
|
同樣的,在hello-sbt-eclipse/project/下建立plugin.sbt檔案,內容為:
?1 2 |
addSbtPlugin( "com.typesafe.sbteclipse"
%
"sbteclipse-plugin"
%
"2.4.0" )
//
2013/10/28
|
匯入專案到IDEA
在hello-sbt-idea/下開啟命令列,執行: $sbt > gen-idea 完成後,專案根目錄下生成了.idea和.idea_modules檔案 啟動IDEA,選擇開啟專案,可以看到idea已經識別出hello-sbt-idea了。
根目錄下的project資料夾(圖中選中項)被轉換成一個模組
1 2 |
$sbt
>
eclipse
|