IntelliJ IDEA 13:新的 Scala SBT 项目尚未生成 src 目录结构 [英] IntelliJ IDEA 13: new Scala SBT project hasn't src directory structure generated

查看:42
本文介绍了IntelliJ IDEA 13:新的 Scala SBT 项目尚未生成 src 目录结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照 Jetbrains 网站上的入门视频设置 IntelliJ IDEA 13.1 社区版以使用 Scala.Scala 插件 v0.36.431 已安装.当我使用向导创建一个新的 Scala SBT 项目时,项目中没有生成 src/ 目录结构.只生成了两个 sbt 文件:

I followed the getting start video on Jetbrains website to setup IntelliJ IDEA 13.1 Community Edition to work with Scala. Scala plugin v0.36.431 had been installed. While I created a new Scala SBT project with wizard, there was no src/ directory structure generated in the project. Only two sbt files were generated:

scala-course/
├── build.sbt
└── project
    └── plugins.sbt

从视频和其他文档我知道应该有一个src/目录结构,包括src/main/scalasrc/test/scala等sbt默认使用与Maven相同的目录结构存放源文件.

From the video and other document I know that there should be a src/ directory structure, including src/main/scala, src/test/scala, etc. sbt uses the same directory structure as Maven for source files by default.

我可以手动创建这些文件夹并将其标记为源根目录.然而这是微不足道的.所以我的问题是:为什么 IntelliJ IDEA 新项目向导不生成文档中所述的目录结构?我做错了什么吗?我检查了首选项,但找不到任何相关的内容.

I can create those folders manually and mark it as source root. However it is trivial. So my question is: Why IntelliJ IDEA new project wizard doesn't generate the directory structure as said in document? Was I doing something wrong? I checked the preferences and couldn't find anything that seems related.

推荐答案

感谢 lpiepiora,他的 hint 我发现找出原因.

Thanks to lpiepiora, with his hint I find out the reason.

因为我的sbt是新安装的,所以~/.ivy2/cache/~/.sbt/boot/里面什么都没有.sbt 需要从网络上的存储库中下载所需的依赖项.碰巧我的互联网代理有问题,下载卡住了.

Because my sbt is newly installed, there is nothing in ~/.ivy2/cache/ and ~/.sbt/boot/. sbt needed to download required dependencies from repositories on network. It happened that my proxy to internet had something wrong, download stuck.

另外需要注意的是,如果在后台运行 sbt 时退出 IntelliJ IDEA,下次你会得到等待某个锁定文件的错误.必须删除文件系统上的锁定文件并重新启动 IntelliJ IDEA.

And also need to notice that, if quit IntelliJ IDEA when sbt is running in background, the next time you'll get error of waiting for some lock file. Have to remove the lock file on filesystem and restart IntelliJ IDEA again.

修复网络问题后,一切正常.下载所需的 jar 文件需要几分钟,取决于网络速度.完成后,src/目录结构就创建好了.

After fixed the network problem, everything work as promised. It requires several minutes, depends on network speed, to download required jar files. After finished, the src/ directory structure is created.

这篇关于IntelliJ IDEA 13:新的 Scala SBT 项目尚未生成 src 目录结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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