There is some project. It contains pom.xml , which describes the dependencies.

The project is created in Intellij IDEA .

How to add libraries to the project so that they download and hook into the IDE so that no problems like "class not found" arise later.

Of course. In IDEA usually when adding dependencies to the pom file, an inscription appears with Auto-import for maven. As a result, click there and all the libraries are successfully added to the project.

And how to do the same, only from the command line (using even the one that is in the IDE itself) using maven ?

  • I do not understand the question. The command line is required to do what? Edit pom.xml file? - JBaruch
  • @JBaruch, on the command line, execute the mvn "что-то там" command mvn "что-то там" so that the jar library files described in dependency are added to the project folder. IDEA can itself perform these things, but still wanted to understand exactly how using mvn this operation. - I. Smirnov
  • And, I understand, I will answer now - JBaruch

1 answer 1

In order for Maven to download dependencies, it is enough to pull off any phase of the cycle for which you want to receive dependencies. Those. if you need dependencies in the compile scope, then you need to pull mvn compile or any phase later compile .