Scala Plugin in Intellij - scala

I am using Scala plugin in IntelliJ. If I want to use Scala in command line, do I have to install regular scala in my machine or is there anyway I can use the Scala plugin installed in IntelliJ outside of IntelliJ?
Thanks,

You have to install Scala separately to be able to use it on the command line. IDEA uses Scala via SBT, but this is not a Scala you could use from a command line. The alternative to using REPL from the IDE could be to use Scala scratch file functionality.

Related

inetelliJ idea - sbt plugin conflicts with Standalone sbt

I want to setup a Spark-Scala-Sbt dev environment on Ubuntu
So i have installed SBT, Scala Seperately before installing IntelliJ.
But after installing intelliJ i have installed the sbt plugin for intelliJ as well.
Now how to avoid conflicts between the 2 sbt's which one to use and how to setup properly to avoid conflict.
Also wanted to know HOW .. the installed Scala & SBT is different from the scala & sbt plugin that comes with itelliJ IDEA
The standalone sbt plugin is obsolete with IntelliJ Scala Plugin 2017.1, which includes an integrated sbt shell and supports building through that shell.
To avoid any conflicts between different instances of sbt shells, it is best to have only one running at a time - either from the terminal or from IDEA. Other than that you don't need any special setup.

Scala and java interation in Eclipse

I have a Eclipse project (Xtext) and want to use Scala code in the project.
The Scala code also need to use a Scala library which uses sbt.
That will be the best way to perform this integration in Eclipse?

Call Bundled SBT's Commands in IntelliJ Scala Plugin

I am trying to call gen-android command after installing android-sdk-plugin to the project. However, I can't find out how to call a command of the bundled SBT, or do it outside of IDE.
How do you call commands of a bundled SBT of Scala plugin (v.2.2.0) in IntelliJ (v.15.0.3)? Or, is it possible to use the SBT executable outside IntelliJ?
I can of course use a normal SBT regardless but am just curious if I can do everything using one different SBT inside IDE (because it'd be convenient!)

Scala build process

First some context:
My aim is to use scala alongside a testing environment, preferably in an ide.
At first I installed scala (v. 2.10.1) and sbt and it worked. I used emacs and a shell.
Then I wanted to use eclipse and installed the sbt plugin. But when I tried the FlatSpec example of the scalatest website together with the scalatest lib, it did compile but 0/0 tests did run.
In intellij I tried the same example but although I gave my sdk location, the collection package wasn't found.
My problem:
I don't understand what I have to tell my ide or what I have to write (maybe files for maven or make etc.) or where I can learn all that.
My question:
What has the ide to know if I want to run a scala project?
- location of sdk, jdk, sbt, my_project, ...
- versions of scala, java etc.
What else must it know?
IntelliJ has build in support for sbt projects. My work flow is the following :
Create a project (in the shell) using sbt. Basically you have to create a build.sbt and the necessary directory structure
`src/main/scala`
`src/main/resources`
`src/test/`
The in IntelliJ just do Open -> select build.sbt.
Also check auto-import checkbox.
Everything should work after this.
NOTE: You may have to install the Scala and sbt plugin for the above to work.

Access the Eclipse Scala compiler from the terminal

I'm just starting out with Scala (trying to setup Eclipse, Lift and SBT on Mac Lion) and I'm not sure if I need the scala compiler through homebrew or can I just use the built in Eclipse Scala compiler through Eclipse and (if I also need to) through the Terminal.
If that's a good idea, how do I run it through the terminal ?
You won't be able to access the Eclipse-IDE scala compiler through terminal, so if you want terminal access, you should install a standalone scala interpreter separately.
While you don't technically need terminal access since Eclipse will compile everything for you and you can run the interpreter through Eclipse (Window -> Show View -> Scala Interpreter), I like to have the option, so I always have a separate installation of the same version of the compiler that Eclipse uses.
Instead if installing scala, I normally have a blank sbt project, and start the scala REPL by doing
sbt console
This allows me to easily change scala versions and if I add dependencies to the project, they will be added to the console classpath.