user2850243
user2850243

Reputation:

Intellij Idea add Scala support to existing Java project

Intellij Idea add Scala support to existing Java project. Just cannot figure it out How to add Scala worksheet to existing Java project? It would be just nice to have Scala REPL or worksheet. But after resiarsh and trying I failed to do that.

Upvotes: 8

Views: 7616

Answers (2)

chaotic3quilibrium
chaotic3quilibrium

Reputation: 5934

If you want add a "Scala sub-project" into your Java project, you can use the "New Module" functionality.

To do this...

  1. Bring up the right mouse button pop-up menu on your Java project root
  2. Select "New/Module..."
  3. From the "New Module" dialog that appears, select "Scala" from the left side (assuming you have already added the Scala plug-in)

This will do all the setup work needed for you to have a Scala project.


Protip: You will want to change the line within the automatically generated build.sbt (lazy val root = (project in file(".")) to something like...

lazy val root = (project in file("scalasubprojectfoldername")

This will ensure the project and target folders will remain in the Scala sub-project, as opposed to being placed into the root Java project.

Upvotes: 1

Alexey Romanov
Alexey Romanov

Reputation: 170919

To add Scala support to existing module:

  1. Right-click the module in Project View, choose “Add Framework Support…”
  2. Check “Scala” in technologies list (unavailable if module has Scala facet attached)
  3. Provide a path to Scala installation (if not detected)

From http://blog.jetbrains.com/scala/2010/09/02/project-configuration-explained/.

Upvotes: 14

Related Questions