Search code examples
mavenintellij-ideaintellij-14

Intellij IDEA does not update pom.xml file


I just created a blank Java Maven project in IntelliJ IDEA 14.1.5 (I didn't select an archetype), it's a console app. After adding a library dependency via Maven dialog, it was added to .iml file but not to the pom.xml. So if I run mvn package either from IDEA or command line it can't find the dependency.
What did I do wrong? (just starting to work with JVM/Java)


Solution

  • Idea doesn't work like that. You should go to edit the pom, create a dependencies tag, and within that hit alt+insert (standard key bindings). This will give you some help in creating your dependency.

    Alternatively you could just find your dependency in a browser from mvnrepo.org or some other place, and copy/paste the dependency into your dependencies section. Reimporting the maven project will then fix everything -- Intellij will download the required dependency and ensure its referenced within the IDE.