IntelliJ, Scala plugin and h2-browser - scala

Is there any way to add the h2-browser flag in a Play 2 IntelliJ run configuration? I prefer not to manually run sbt and / or and sbt console.

Related

IntelliJ: what difference between "SBT Console" and "SBT Shell"?

In the IntelliJ I see two tool windows: SBT Console and SBT Shell. What is the difference between these tools?
You may have installed both scala and sbt plugins. The newer version of scala plugin has sbt as part of it.
sbt console is the sbt plugin -- click start you will enter into sbt interactive mode.
sbt shell is part of the scala plugin, which is similar to the above mentioned sbt console and can autocomplete commands.
Here is a description: https://blog.jetbrains.com/scala/2017/03/23/scala-plugin-for-intellij-idea-2017-1-cleaner-ui-sbt-shell-repl-worksheet-akka-support-and-more/
SBT Console plugin is deprecated in favour of IntelliJ Scala Plugin. Deprecation notice states:
JetBrains have recently added support for an SBT console to the
IntellIJ Scala Plugin. This is now the recommended way to use SBT
within IntellIJ. No new releases of this plugin are planned.

Can not download jars when building scala project with sbteclipse?

As shown in the picture, when I build scala project with sbteclipse and import to eclipse, when changing build.sbt , jars are downloaded to my computer but not to scalaProject. I do not know why. Can someone help me?
scala version: 2.11.8
sbt version: 0.13.15
stbeclipse:5.1.0
I assume that you're using the Scala IDE plugin for Eclipse, correct?
The sbteclipse SBT plugin merely provides a command to generate an Eclipse Scala project from the SBT build. Before using Eclipse, you're supposed to issue the following command (from the command line) to SBT:
sbt eclipse
This should generate the project files for your Eclipse project. After executing this command, you can open your project using Eclipse (with the Scala IDE plugin).
Note that, at present, the Scala IDE Eclipse plugin does not support SBT build files. That is, if you change your SBT build file, then Eclipse will be none the wiser, until you re-run the above command.
You might want to consider switching to IntelliJ IDEA (instead of Eclipse) which has a full-featured Scala plugin that fully supports SBT builds, including downloading any dependencies. For my money (both IDEs are free) IntelliJ is light-years ahead of Eclipse for Scala development.

How to execute SBT plugin's tasks from within IntelliJ IDEA CE?

I use IntelliJ IDEA 13.1 Community Edition with the Scala plugin 0.32.593.
What's the recommended way to execute a SBT plugin's tasks, say dependencyUpdates from sbt-updates?
In version 15 of IntelliJ IDEA, using Scala Plugin version 2.0, you can run SBT tasks by adding a run configuration.
First add a new run configuration by clicking on Run -> Edit Configurations. Then click the + button to add a new configuration and choose SBT Task form the list
Now provide the list of tasks separated by space in Tasks input box:
NOTE IntelliJ IDEA and the Scala and sbt plugins have improved since and you may want to read How to run sbt-assembly tasks from within IntelliJ IDEA? instead.
I worked it around with the Embedded Terminal plugin that shipped with the version of IDEA.
Alt+F12 (or Tools > Open Terminal) to open a terminal window and then sbt dependencyUpdates inside.
It does require a local installation of SBT.
Unless there has been a recent change (in 13.1), SBT plugin doesn't support running sbt tasks.
See comments here http://blog.jetbrains.com/scala/2013/11/18/built-in-sbt-support-in-intellij-idea-13/
You will have to run these two commands to run SBT in the terminal:
SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar `<SBT inatall>`/bin/sbt-launch.jar "$#"

How to Point Intellij at SBT Libraries for Scala Project

I'm trying to use this example: https://github.com/spray/spray-template for a Spray project, however I can't figure out how to point Intellij at the dependencies downloaded via SBT.
Any suggestions?
If you're using IntelliJ version 13, you need only the Scala plug-in (which has built-in SBT support); just open the project by selecting the build.sbt file.
Use this SBT plugin to generate Intellij IDEA project files: https://github.com/mpeltonen/sbt-idea
Add SBT plugin for creating IntelliJ IDEA projects in your ~/.sbt/0.xx/plugins/build.sbt or PROJECT_DIR/project/plugins.sbt. Use gen-idea command to create an IntelliJ project and open the project in IntelliJ. That should be it.

how to load activator in intellij with sbt plugin

I'm a novice on sbt.
I looked at activator project
Now I see it uses sbt and there are sbt and scala files under the project directory.
But i was sure there would also be a main sbt (like main pom) in main directory where I can open it in intellij with sbt plugin and it would open all projects in the IDE.
Can anyone please let me know how to open this project in intellij with all its dependencies? Most probably with intellij sbt plugin because it uses sbt (i mean like in maven would bring all sub dependencies)
I never used intellij sbt plugin.
But you could try to add the sbt idea plugin to the plugins.sbt file.
Then you can generate the intellij idea project files with the gen-idea task.