如何将源代码添加到Intellij Idea的scala项目中?
问题描述:
我是scala新手。并开始我想使用Intellij 13.1.5 IDE。如何将源代码添加到Intellij Idea的scala项目中?
但是IDE无法附加源代码。下面是它的外观为AnyVal
:
Search at internet
找不到任何来源。
我试过Attach sources
并附上解压后的scala文件。它也不起作用。
UPDATE:
下面是SBT onfiguration:
name := "scalatest-selenium"
version := "1.0"
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
"net.sourceforge.htmlunit" % "htmlunit" % "2.14",
"org.seleniumhq.selenium" % "selenium-java" % "2.42.2",
"org.scalacheck" % "scalacheck_2.10" % "1.11.4" % "test",
"org.scalatest" % "scalatest_2.11" % "2.2.0" % "test"
)
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-u", "target/test-reports")
如何解决这个麻烦?
答
我得到下面的方式摆脱这种麻烦:
在主文件夹删除.sbt
目录。
当您再次运行sbt时,将以正确的格式创建新文件夹,并且错误消失。
是否仅限于'AnyVal'(或'Any' /'AnyRef' /'Unit' /'Nothing')?那些没有真正的源文件,主要是编译器结构。否则 - 根据[本教程](http://www.plotprojects.com/create-an-intellij-idea-project-with-library-sources-attached/) - ,您需要添加'withSources()'到sbt中的依赖关系。 –
@GáborBakosHense哪些scala课程应该检查以确认来源是否已附加? –
可能['scala.App'](https://github.com/scala/scala/blob/v2.11.6/src/library/scala/App.scala#L1)。嗯。看来我错了,这些类([AnyVal](https://github.com/scala/scala/blob/v2.11.6/src/library/scala/AnyVal.scala#L1))已经有源代码。不知道你能分享你的sbt配置有什么问题吗? –