Is there a way to have it so that when I add a new dependency in my pom.xml file the corresponding library will be automatically downloaded. I am using IntelliJ if that is relevant.
-
I'm not sure what your real question is: It is downloaded automatically if you add a dependency to your pom file? ... – khmarbaise Dec 25 '19 at 19:09
-
I am asking how do you make it so that the needed libraries are downloaded based on what is in my pom file. Otherwise it seems that I would have to manually add all 15 or so of them. – Void Dec 25 '19 at 19:10
-
1Does this answer your question? [Import Maven dependencies in IntelliJ IDEA](https://stackoverflow.com/questions/11454822/import-maven-dependencies-in-intellij-idea) – Gerold Broser Dec 25 '19 at 19:11
-
Nice that worked! – Void Dec 25 '19 at 19:17
1 Answers
Maven doesn't download all dependencies when added in pom.xml. At first it will looked up in your local repository. If that artifact with desired version doesn't exist locally Maven tries to download from preconfigured remote repositories.
In IntelliJ when you add a new dependency to your pom.xml a dialog box or modal will shows up with two options: Import changes
and Enable Auto-Import
. If you choose Enable Auto-Import
then newly added dependencies will be resolved automatically.
If you want to enable this feature globally then go to: File > Settings > Build, Execution, Deployment > Build Tools > Maven > Importing and chek the Import Maven Projects automatically option. Additionally you can select which other artifact types will be downloaded. In this window there is a section Automatically download. Just enable those other types if you want.

- 2,508
- 2
- 14
- 22
-
I think that this answer is a bit more accurate for my situation than the other question, so I don't think this should be marked as a duplicate. That post is 7 years old after all. – Void Dec 25 '19 at 19:19