How to use existing Scala with Intellij - scala

I already have brew install scala - I am able to run Scala via command line. After that I installed IntelliJ version 2016.1.3
While installation process of IntelliJ, I was asked to install Scala plugin but i clicked no - because I already have Scala installed
Now I am trying to figure out where exactly we can create a Scala application with the use of my existing Scala installed. How and where in the IntelliJ can I set this up? I can only see Java projects available to be created.
Thanks

You can't. The Scala you have installed is a completely different thing from the IDEA Scala plugin.
The Scala plugin is what you need to handle Scala projects, editing Scala files, etc. in IDEA. The command-line Scala is just the compiler and the standard library, it doesn't know anything about IDEA.
Also, for the command line you should install SBT instead of working directly with the Scala compiler unless you want to handle dependencies, classpaths, etc. manually (you don't).

If you want to create Scala application using IntelliJ IDEA, you will need to install the Scala Plugin.
Step 1: Open IntelliJ Preferences or Settings
On Mac:
Open IntelliJ IDEA.
Then click on the menu item IntelliJ IDEA and select Preferences.
On Windows:
Open IntelliJ IDEA.
On the bottom right corner of the Welcome to IntelliJ screen, select Configure.
Step 2: Find and install Scala Plugin
After opening the Preferences or Settings screen from Step 1, click on the Plugins section on the left panel.
Then click on the Install JetBrains plugin… button.
This opens another window which has a Search box on the top left corner. Type in Scala in the search box and this will list the Scala plugin which you need to install.
Hit the Install button to kick off the installation.
Do not forget to Restart IntelliJ following the install.
And Voila! You should now be able to create Scala projects in IntelliJ.
For further instructions on how to install Scala plugin in IntelliJ, you can follow the instructions from www.allaboutscala.com

Related

IntelliIdea - Cannot see scala in add framework support

I want to run scala code in IntelliJ Idea.
I donot see option scala in Add Framework Support
Please suggest how to do it?
To run the Scala code there is no need to add any framework or facet (things like this were done in some previous IntelliJ versions, but this is long ago).
The only thing you need is to install a Scala plugin.
If you did not install the plugin when installing the IDE, use menu item Settings, click on Plugin, then Marketplace and type Scala.
With a Scala plugin installed, you can create a new Scala project.

Running ApsctJ in Intellij IDEA with Scala

I am using Intellij IDEA Community Edition 14.0.3 for Scala development. I am having AspectJ in my application. I am using sbt-aspect v0.10.1.
I am able to run everything fine when I run the application from SBT console. However, when I use run from the intellij menu, it is not invoking the aspect.
Because of this, I am not able to run in Debug Mode. How can I make it work with intellij ?
I have the same issue.
My workaround is:
Open project Run/Debug configuration on IntelliJ IDEA
In the VM Options field type: -javaagent:path/to/aspectjweaver.jar
path/to/aspectjweaver.jar in my case is C:\Users\aelkin\.ivy2\cache\org.aspectj\aspectjweaver\jars\aspectjweaver-1.8.13.jar
Actually I do not use Scala in IntelliJ IDEA, but Java. Anyway, a quick web search led me to the SBT Community Plugins page which lists these links:
Plugins for IDEs
IntelliJ IDEA
sbt Plugin to generate IDEA project configuration: https://github.com/mpeltonen/sbt-idea
IDEA Plugin to embed an sbt Console into the IDE: https://github.com/orfjackal/idea-sbt-plugin
At the time of writing this GitHub is down for database maintenance, so I cannot check on the projects mentioned there, but in 15 minutes or you should be able to navigate there by yourself and see if the repos actually contain something useful for you.

How to create a Play project in IntelliJ IDEA 14 Community Edition?

I am trying to create a Scala project in IntelliJ IDEA 14. As mentioned in IntelliJ IDEA's help, the Scala plugin already has support for Play 2.x.
I have installed the Scala plugin, and when I create a new project I can select Scala > Scala and Scala > SBT projects but there's no Scala > Play 2.x.
Are there any additional steps needed to make this available? I am using IDEA 14 Community Edition.
I have tried importing module to a Scala project using play-generated .impl file but IDE could not handle it well e.g. was finding errors in completely fine play! views.
Play framework is supported only in ultimate edition of Intellij Idea.
Here https://www.jetbrains.com/idea/features/editions_comparison_matrix.html, section Frameworks and Technologies.
For everyone else looking for an answer for Play 2.4+ the easiest way to get up and running is:
Create a new Run Configuration – From the main menu, select Run -> Edit Configurations
Click on the + to add a new configuration
From the list of configurations, choose “SBT Task”
In the “tasks” input box, simply put “run”
Apply changes and select OK.
Now you can choose “Run” from the main Run menu and run your application
https://www.playframework.com/documentation/2.4.x/IDE

Should I install Scala separately for command line and Eclipse IDE?

I've installed Scala IDE for Eclipse using the update mechanism, and then I found that there's no command line tools included there. So is it correct that I should download another copy of Scala package for the command line support and maintain both separately?
Or is there an integrated way to get it work in both environments? I just want to write and debug code in Eclipse and occasionally run it on the command line.
First, you can open a Scala command-line within Eclipse. Just go to Window -> Show View -> Scala Interpreter, and it will open an interpreter window that has your project loaded into the classpath.
Second, there's nothing wrong with having a separate Scala installation for command-line use. I do this. It's often convenient to have a few terminal windows where you can run stuff or quickly test bits of code.
You need to install the scala compiler first. Otherwise you can not use the eclipse plugin. If you have installed the scala compiler, you just need to add it to your classpath. Now you can type scala into any terminal you are using and the REPL starts.

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.