How to configure Spring facet in IntelliJ IDEA

Go to File/Project Structure/Modules, click the green plus icon, select Spring from the dropdown and select your module in the next dialog.

Then click the green plus in the right pane, click plus and select your Spring configuration files and classes and click OK.

Also take a look at IntelliJ Help for Spring Facet.


Just ran into this issue out of the blue today—my build was working last night, and this morning it stopped working—so I figured I'd post my solution using IntelliJIDE CE 2019.1.

Error Messages (to help people find this answer)

package org.springframework.transaction.annotation does not exist
package org.springframework.boot does not exist
Unknown facet type: 'Spring'
Unknown facet type: 'web'

enter image description here


Solution

Step 0: Update IntelliJ

Menu: IntelliJIDE > Check for Updates (Mac OSX) 

Step 1: Clean out Maven repo and re-download dependencies to ensure that the sources are not corrupt. This will take 5+min.

$ cd [project_directory]
$ mvn dependency:purge-local-repository

Step 2: Preform a clean install.

$ mvn clean install

Step 3: Update IntelliJIDE's Repository Indexes:

  1. Open IntelliJ Settings/Preferences
  2. Build, Execution, Deployment > Build Tools > Maven > Repositories
  3. Select repositories one by one (by clicking on the table row) and click the update button. Specifically, do it for https://repo.mave.apache.org/maven2. The download is ±700mb so it will take a while. (10+min) enter image description here

Related Questions

  • getting package org.springframework.transaction.annotation does not exist error while packaging app
  • package org.springframework.boot does not exist

IntelliJ Ultimate 2018 - the manual way:

  1. Menu File -> Project Structure
  2. Right-click on your module and choose "Add..." -> Spring
  3. Optionally click "fix" if spring is not listed as a dependency
  4. Click the + icon at the top to add your spring configuration .xml file(s)

enter image description here

The automatic way:

  1. Click the body of the popup notification
  2. Click the "Create Default" option

enter image description here