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'
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:
- Open IntelliJ Settings/Preferences
- Build, Execution, Deployment > Build Tools > Maven > Repositories
- 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)
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:
- Menu File -> Project Structure
- Right-click on your module and choose "Add..." -> Spring
- Optionally click "fix" if spring is not listed as a dependency
- Click the + icon at the top to add your spring configuration .xml file(s)
The automatic way:
- Click the body of the popup notification
- Click the "Create Default" option