I am trying to solve this problem that I am facing. I have sbt version 0.12.2 installed on my laptop but every time I go to my scala assignment folder and start sbt from command prompt it automatically tries to download sbt 0.12.1. I gathered from the
build.sbt
file that the project is targeted at scala version 2.10.1 but I couldn't find anything on the sbt version.
My question is: Is there such a thing as sbt target version? If there is how and where can I modify it?
Note: I can provide the build.sbt file if it helps in solving this problem.
Usually the version of SBT used by a project is specified in a properties file.
Try looking in project/build.properties.
See the "Getting Started" guide here.
Related
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.
I have sbt 0.13.16 and Scala 2.10.6 running with Intellij 2018.2.1, working with those recommended sbt and Scala settings for Odersky's coursera course on Scala (I'm guessing their automated submission grader depended on old SBT?).
When creating new sbt + scala projects, I choose the above sbt and Scala versions, then after all the dependencies have downloaded, when I right-click New -> ... I see options for Java class but nothing for Scala. I have the Scala plugin already there according to the plugin settings.
So I try to Add Framework Support after right-clicking on the project, I select Scala, but then everything is disabled except Cancel.
I looked through previous forums, found one but that seemed relevant only for git projects.
Anyone else run into this issue? Do I need to update to more recent Scala and SBT? Any help would be very appreciated.
Please check https://plugins.jetbrains.com/plugin/1347-scala/versions for a compatibility table.
You can manage plugins in IntelliJ Preferences. Your versions seem to be too old to still be supported, already. It may help to upgrade IntelliJ and then go to preferences and get the latest Scala and SBT plugins.
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.
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.
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.