Scala Maven project setup
What's inside this article
⌄
- Scala Maven IntelliJ setup
- How to create Scala Maven project
- IntelliJ Scala Maven configuration
- Scala project setup IntelliJ Maven
To create a Scala project using Maven to manage dependencies in IntelliJ IDEA, you first need to install the Scala plugin:
- File -> Preferences (Settings) -> Plugins
- Search Scala in the Marketplace
- Install it and restart IntelliJ IDEA
Next, let’s create a regular Java + Maven project:
- File -> New -> Project
- Select Maven -> Next -> Finish
- Right mouse click on main project module in Project tab on the left side of the screen
- Add framework support
- Select Scala and click on the Create button at the right side of the window
- Next, click Download -> OK
- Then, select Downloaded library -> OK -> OK.
- Rename
src/main/javafolder tosrc/main/scalaby clicking right mouse button -> Refactor -> Rename. - Next, add some dependencies to Maven’s
pom.xml. - Feel happy 😁
Sometimes, IntelliJ IDEA does not immediately begin to see the dependencies from Maven. Then try this:
- Right mouse click on main project module in Project tab on the left side of the screen
- 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.