I am new to both IntelliJ and Scala. I am attending the course "Functional Programming Principles in Scala" on Coursera. I downloaded the zip file for the sample assignment, which contained a sample Scala project.
I imported the project successfully (I guess) in IntelliJ. However, when I right-click on a package in the project explorer, there are no Scala-related templates. I can only select "New Java class", XML files and some forms.
Does anyone know why this happens and if there is another way to create a new Scala class or object from a template?
Thanks.
On the Project pane on the left, right-click src and select New => Scala class. If you don't see Scala class, right-click on HelloWorld and click on Add Framework Support…, select Scala and proceed. If you see Error: library is not specified, you can either click download button, or select the library path manually.
To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA. Now you can successfully check out from VCS, create, or import Scala projects.
To add Scala support to existing module:Right-click the module in Project View, choose “Add Framework Support…” Check “Scala” in technologies list (unavailable if module has Scala facet attached) Provide a path to Scala installation (if not detected)
Yes, you need to make the scala directory a source directory (in Menu / Project structure / Modules ) but I also had to do the following:
Now my context menu gives me New / Scala class and so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With