Scala + Maven + IntelliJ IDEA project setup

To create a Scala project using Maven to manage dependencies in IntelliJ IDEA, you first need to install the Scala plugin:

  1. File -> Preferences (Settings) -> Plugins
  2. Search Scala in the Marketplace
  3. Install it and restart IntelliJ IDEA

Next, let’s create a regular Java + Maven project:

  1. File -> New -> Project
  2. Select Maven -> Next -> Finish
  3. Right mouse click on main project module in Project tab on the left side of the screen
  4. Add framework support
  5. Select Scala and click on the Create button at the right side of the window
  6. Next, click Download -> OK
  7. Then, select Downloaded library -> OK -> OK.
  8. Rename src/main/java folder to src/main/scala by clicking right mouse button -> Refactor -> Rename.
  9. Next, add some dependencies to Maven’s pom.xml and feel happy.

Sometimes, IntelliJ IDEA does not immediately begin to see the dependencies from Maven. Then try this:

  1. Right mouse click on main project module in Project tab on the left side of the screen
  2. Choose Maven section at the bottom of the list -> Reload Project

If that doesn’t work, close IntelliJ IDEA entirely and open again.

If there is no positive result again, click File -> Invalidate Caches -> Select all check-boxes -> Invalidate and Restart. After that actions the problem should go away.

If you still have any questions, feel free to ask me in the comments under this article, or write me on promark33@gmail.com.

If I saved your day, you can support me :)

Leave a Reply

Your email address will not be published.