Maven integration facilitates working with dependencies. IntelliJ IDEA helps generate dependencies in the pom.xml files.
- Open the desired pom.xml file for editing.
- With the editor tab having the focus, choose Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertCtrl+N or Alt+InsertAlt+InsertAlt+InsertCommand N or Control EnterControl N or Control EnterCommand N or Control Enter, and choose from the Generate pop-up window. on the main menu, or press
- In the Maven Artifact Search dialog box, select the desired
dependency to be added.
Note that you can search either in the artifacts, or in the classes. To do that, type the search
string in the
text field to narrow down the search scope, select the desired dependency, and click Add.
- When searching in artifacts, the search string can refer to the ArtifactId, GroupId, and version of an artifact.
- When searching in classes, IntelliJ IDEA searches through all the available artifacts, and adds all libraries, where the class with the specified name is detected.