r/javahelp • u/Lvl20Rogue • Dec 29 '19
Understanding Maven
So i'm recently getting into maven for the first time in my life. I'm a bit confused and i think it's because i don't really know what maven does. I have this POM.XML file in my project. Do i just add a dependency there and maven will magically find the JAR and download it for me, or do i need to somehow also manually download the JAR and the POM just points at it?
Help would be greatly appreciated!
17
Upvotes
13
u/joranstark018 Dec 29 '19
Maven will automagically download all dependencies for you.
Maven will download and cache dependencies locally. If you add a new dependency it will first look in the local cache, if not fond there it will search the external repositories, if not found there it will fail the build with an "unresolved" error.
By default Maven will use Maven Central as remote repository you can change this if you have some corperate repository or if you want to include a repository from some third part, it's a list of url:s).