【发布时间】:2016-04-20 22:33:57
【问题描述】:
项目编译并运行良好,但源代码在 IDE 中看不到库。
注意中间,编辑器无法识别来自项目中库或其他模块的导入,尽管您可以看到左侧的库。
我感觉这是因为我对模块系统的工作原理缺乏了解。我从源代码和 build.sbt 开始,并在 IntelliJ(最新版本 15.0.5)中使用了File > New > Project from Existing Sources。 IntelliJ 为项目创建了单独的模块 build、main 和 test。 main 和 test 似乎无权访问依赖项。
我查看了项目结构,果然,依赖项存在于顶级“tcparser”模块,但不存在于“main”或“test”:
所以我点击右侧的绿色+ 并尝试为test 模块添加库依赖项,但我收到错误消息Module "tcparser" must not contain source root "path to \src\main\java". The root already belongs to module "main",这对我来说毫无意义。
发生了什么,我该如何解决?我并不是特别想将我的项目分成模块,所以如果这是解决方案,我可以摆脱它们。
【问题讨论】:
标签: scala intellij-idea sbt