I am a beginner to Maven and using build tools like it in general. I am running Maven mvn in the terminal to understand how it works better. I found this FFT library, git-cloned it, found a pom.xml inside it and ran
mvn package
The build completed and a target/ directory was created with the JAR file for the library inside. However, I inspected the POM file and found that there were dependencies for junit, which are needed for running tests written in src/test/ but there were no JAR files created in target/ for junit (and I needed to download them separately from MVN repository and place them in target/). So my question is how does Maven actually build the JAR file without also pulling the JAR file(s) for junit? My current understanding is that it parses the POM file and goes through each dependency and downloads and installs them if they isn’t present (like Make i guess?).
>Solution :
Maven downloads and keeps the dependencies in the local Maven repository that can be found in ~/.m2/repository. This is done so that builds can share the dependencies, and so that they don’t get lost if you run mvn clean.