IntelliJ IDEA 12 versus sbt 0.13 - scala

I am updating a couple of projects to sbt 0.13. I am using IntelliJ IDEA 12 (not interested in EAP 13 at this moment). I am using the sbt plugin by orfjackal. By default it uses an sbt-launch.jar bundled with IDEA. At least the settings claim that. That has version 0.12 and cannot be launched now because of some JLine incompatibility.
If I go to Settings -> Project Settings -> SBT -> IDE Settings, and specify the 0.13 launcher as custom jar, it works while IntelliJ is open. But the settings are lost when I quit and restart IntelliJ.
So my new idea is to try to replace the bundled sbt-launch.jar. If I open the app bundle (OS X) and search for that name, nothing shows up.
Where is the bundled sbt-launch.jar and how can I swap it?

I believe that SBT jar is located inside your configuration directory. Usually it is something like ~/.IntelliJIdea12, so simple search in this directory gave ~/.IntelliJIdea12/system/sbt/sbt-launch.jar. Try replacing it.
BTW, there is currently a new official SBT plugin being developed by JetBrains. It really is great and simplified SBT usage inside IDEA a lot (esp. dependency management), but it does not have embedded console yet (it will, soon). You can try it out even in 12.X IDEA.

Related

IntelliJ IDEA 2020.3 Scala plugin isn't working with new projects

I just formatted my computer and installed the new macOS Big Sur. I installed IntelliJ IDEA 2020.3 with the Scala plugin version 2020.3.17. I'm running GraalVM 20.3, Scala 2.13.4 and sbt 1.4.4 outside IntelliJ with no issues so far.
IntelliJ loads my projects just fine and everything works perfectly. The problem is when I try to create a new Scala/sbt project. IntelliJ isn't creating the build module as expected and, because of that, IntelliJ doesn't recognize any source code at all.
All installs were clean, I didn't recovered from any backup, just installed as it was a new computer. I also own a valid IntelliJ IDEA Ultimate license. I tried uninstalling everything, but with no success. There's no way I can make it work.
The steps to reproduce my issue:
Open IntelliJ IDEA -> New project -> Select Scala on the left panel -> Select sbt on the right panel -> All defaults on next screen -> Wait for IntelliJ to index everything and creates the modules.
That's it. After finishing indexing, no build module is created. If I open my build.sbt file, all it shows is it can't find any symbol and it doesn't highlight the src/main/scala as source code folder. Actually, it doesn't highlight any folder at all.
Anyone out there with the same issue and/or solution?
Yes, I had the same problem as you. I rebuilt the project step by step by creating a new one starting from the sbt dependencies and plugins. Basically I solved it by setting the sbt version to sbt.version = 0.13.18 inside the project / build.properties folder. By inserting scala-sdk-2.12.12 as global libraries in the project structure and Java 12 as SDK
This issue is gone with latest updates from IntelliJ.

How to use SBT with Intellij Idea

I am using Scala version 2.10 and SBT version 0.13.8. To build a project I am currently executing the sbt commands through the Intellij terminal but I would like to know the use of SBT Tasks window on the right hand side of intellij idea window. Kindly have a look at the screenshot uploaded
How can I run SBT tasks (compile, run, package) in Intellij from SBT Tasks? Is my intellij configuration correct?
It looks like you're using an older version of IntelliJ IDEA. That the window displays "tasks" is probably a bug, because running tasks from this window is currently not supported by the Scala Plugin. I still recommend upgrading IDEA to version 2016.3, which also supports a newer version of the plugin.
Instead, you can run them from the terminal as you do now, or create a run configuration clicking on Run -> Edit Configurations. Then click the + button to add a new configuration and choose SBT Task from the list, and entering the tasks you would like to run.
Side note: When using sbt for your projects, the Scala version installed on the system doesn't matter. In fact, it doesn't even need to be installed.

IntelliJ 14 - Create / Import a Scala / SBT project

IntelliJ 14 supports (in theory) SBT / Scala projects through the Scala plugin, which is still available in the official repo. According to this post "Scala plugin project itself now uses SBT for build and dependency management". However I cannot find any way to create or import a SBT / Scala project with IntelliJ. There is also a lack of documentation explaining more about this new way of configuring the Scala Plugin.
I have the Scala plugin activated in the IntelliJ Ultimate 14.0 (139.224). Any ideas?
Install scala plugin. Settings -> Plugins -> Scala -> Install
Open directory with sbt build: File -> Open Project -> select directory with build.sbt -> configure settings
That worked for me just a couple of minutes ago. It may be necessary to reset cache and restart: File -> Invalidate Caches / Restart.
I've finally figured out the exact problem. IntelliJ loaded the default settings of the previous version, including the old version of the Scala plugin. The problem was fixed uninstalling the old Scala plugin and following the steps posted by Eugene Zhulenev
Make sure you have the scala plugin for intellij.
Go file>new>'project from existing source', select your project to import.
Go to build.sbt and there should be a prompt to import the packages.
Sometimes, you can try to file>synchronise or file>'invalidate cache and restart'.
I tried the following steps but they didn't help:
Invalidate cache and restart IntelliJ
Close the project and re-import the project
Uninstall the Scala plugin and reinstall it
Eventually, I removed the target folders in the project, and re-imported it. Then it worked.

Eclipse running lift project (project configuration issues)

Trying to get a lift project to run on windows, I've installed maven on my computer, then tried to use
mvn archetype:generate from cmd, then chose the lift basic one , but it always failed on the jetty:run part. Before that, I had to change a lot of the pom.xml file to even get a successful build (since the tutorial I was using was obsolete and it couldn't find the dependencies).
So I've decided to try with the eclipse plugin, thinking it should be easier.
I've installed the maven plugin for eclipse and created a project with the lift archetype.
The project was succesfully created, but I have all kinds of errors in the editor for missing ; and so on (I have scala ide installed on eclipse also and creating a normal scala project works and compiles/runs fine). I have also tried to include the scala-library.jar in the buildpath, with no change.
The odd part is that I can run the cmd and go to the project folder, then run mvn jetty:run and it will actually work (?!) Trying to run in eclipse with jetty:run as goal will give me ClassNotFoundException on the HelloWorld snippet.
So what might be wrong with my settings?
UPDATE: no luck whatsoever, after trying 3 different eclipse versions, installing the maven for scala plugin and following every tutorial I could find. It just simply feels all is outdated on the instructions:
this is how it looks after I include the scala libraries for eclipse on every project (after I create it from an archetype):
is this "mvn archetype:generate" up to date? I don't know if anybody guarantees it will work at all..
Anyway, the default way to at least try Lift and see it working is the following: https://github.com/lift/lift_25_sbt
It uses "Simple Build Tool" instead of maven, but maven should work, too. Also, you can easily read "build.sbt" to get all the dependencies.
Plugins for creating eclipse/intellij project definitions are included. (See the README of the demo project.)
The target to create eclipse project is "eclipse" or "eclipse with-sources=true".
The target to launch the app is "container:start".

Scala / Lift: Set up hotdeploy through Eclipse?

How do I set up hotdeploy for Scala/Lift projects in Eclipse?
Basically, I would like to be able to
Set up a new project, from say lift-archetype-basic
Launch jetty:run, either from some run-configuration or through terminal
Be able to edit Scala files in Eclipse, Save/Auto compile
Refresh the web-page in the browser and see the updates.
The tutorial at http://wiki.liftweb.net/index.php/Using_eclipse_hotdeploy is out-dated and I really can't figure out how to set this up.
I currently have
Eclipse 3.5
Maven IAM plugin version 0.11
Scala plugin 2.8.0.RC6
Should I use any other versions or plugins?
With SBT it's possible to continuously recompile and reload the web application when using Jetty:
jetty-run
~ prepare-webapp
jetty-run starts Jetty and the ~ prepare-webapp recompiles and recreates the web application whenever sources files change.
SBT is compatIble with Maven and Ivy, so you may generate the project file layout with Maven archetypes, and switch to SBT later - it will recognize repositories and dependencies specified in the POM.
This tutorial video shows, how to get stated with SBT and Eclipse.