Call Bundled SBT's Commands in IntelliJ Scala Plugin - scala

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!)

Related

Scala Plugin in Intellij

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.

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 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.

IntelliJ 404 scala lang

Ok, I need some help in setting up a Scala project with IntelliJ, I have download and installed the project successfully, but i have had issues when it comes to installing the Scala compiler itself, WHen i go to configure a new Scalaa project and choose to set the Scala home, I choose the download Scala option and i get the following error "downloading failed, connection failed with error 404: http://www.scala.lang.org/downloads.distrib/files/scala2.10.0+RC2.tgz" i have tried downloading the things, such as primefaces and jSF through intelij, and they all work fine, any suggestions?
Download Scala manually and just select proper directory in new project window.
http://www.scala-lang.org/download/
You should be using SBT to define and build your project. Among other things, it handles retrieving the Scala compiler and libraries. IDEA is similarly self-contained as far as its Scala plug-in's internal Scala compiler is concerned. By using SBT and IDEA (see below for connecting the two), the only thing not covered is a Scala REPL for use outside of either SBT or IDEA. If you're using a Mac, Homebrew includes a Scala formula. Because SBT retrieves the Scala compiler and libraries for the version of Scala you specified, everything is self-contained.
By far the best way to build and maintain IDEA project definitions for Scala projects is with the sbt-idea plug-in for SBT. Once you install that plug-in, which is trivial, you simply use the gen-idea SBT task it provides. When your dependencies change, you run gen-idea again to update the project.

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.