Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Maven building successfully without actually downloading dependencies?

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?).

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading