How to setup Intellij for Scala 2.10

我们两清 提交于 2019-12-03 09:17:14

问题


  • First I installed macports

  • Then I installed Scala and Play through macports: To make sure installation works I run a "hello world" on eclipse. It works!

  • But since my objective is to use Intellij, I try to follow the instructions at http://confluence.jetbrains.com/display/SCA/Getting+Started+with+IntelliJ+IDEA+Scala+Plugin

  • On step 3 of the instructions (section Creating a Project), under use scala distribution, I am not sure what to type. Will someone please tell me what to type? I am using mac os x mountain lion. I don't know the path to my scala installation.

I appreciate the help. I have already looked at Intellij Idea setup for Scala, clarification needed. No help there. My Intellij version is 12.0.3 and my scala install is 2.10.


回答1:


I don't know OSX but presumably you can open a terminal, type ls -l `which scala` into it, and get the path to the scala executable.

You can then enter that path, without the /bin/scala on the end, into the intellij dialogue.




回答2:


Just for clarification: you can install scala in Mac OS X using Homebrew as @JasonG mentions:

$ brew install scala --with-docs

In that case, the selected solution won't work, as IntelliJ will still complain. Any way, as stated in the caveats of the formula, you will have a directory specially crafted for IntelliJ integration:

==> Caveats To use with IntelliJ, set the Scala home to: /usr/local/opt/scala/idea

Using this directory will make IntelliJ happy.

UPDATE for IntelliJ IDEA 13.x users: This doesn't seem to be needed any more. Just use SBT based projects, and everything will be downloaded and configured automatically (Scala compiler and libraries)




回答3:


You're much better served by letting existing tools do this sort of thing for you.

Define your project using SBT. Use PaulP's (Paul Phillips) SBT launcher and the sbt-idea plug-in that provides automatic generation of IDEA project and module files.

See my previous answer for some details




回答4:


  1. find and install scala plugin in "Preference" -> "Plugins" -> "Browse repositories" -> "Scala"
  2. open project and
  3. open"Project Structure"
  4. open "Facets"
  5. press "Add" / "Plus icon"
  6. select "Scala"

Then you can select scala version and setup compiler




回答5:


I actually downloaded the scala and scala docs from typesafe, unzipped them in a folder as per the instructions, and then pointed intellij at that. Use the sbt plugin as well - it makes life much better.

Alternatively you can use brew to install scala with docs:

$ brew install scala --with-docs

2.9.2 instructions here should work. http://scalacookbook.blogspot.ca/2012/09/scala-for-intellij.html

As a third option, you can just let intellij download scala for you. If it's not found, there is a download button you can hit. I'm not sure if it gets the docs though.



来源:https://stackoverflow.com/questions/14817388/how-to-setup-intellij-for-scala-2-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!