maven repositories

I read here that "the more repositories you add, the slower will be your build". Is that true ?

I thought that if the version of the artifact you have a dependency for is available in the .m2 folder, then the repositories won't even be queried, and if it isn't available, then maven will cycle through them just until it finds the correct artifact, and won't look any further. So in either case, it doesn't consume extra bandwidth.

Answers


As indicated in this question there are some cases where Maven will search for a dependency in remote repositories even though it is already available in your local repository. This happens for SNAPSHOT dependencies or for dependencies missing the pom.xml. So what I can only assume the blog post might mean is that if your build falls under any of these categories Maven will scan the remote repositories you have defined in every build (actually for SNAPSHOTS you can restrict the repositories Maven will scan by enabling/disabling SNAPSHOTS from each repository as needed). If it can't find what it is looking for it will of course have to scan all the repositories before it gives up which means the more the repositories the more the time the scan will take (and in the case of SNAPSHOTS it will scan all the repositories anyway because event if it finds an updated version in one repository it can't "know" that another repository won't holder an even newer version). Even in the case where Maven actually finds the dependency it looks for and stops searching it is possible that the repository where the dependency is found is the last one scanned and so all other repositories are scanned before it.


When you build your project it goes to the m2 repository for checking whether the jars are already present , if not it downloads the jar from the central repository . So if once the jars are downloaded , it doesnt take time when you build the project .


Need Your Help

Gradle - Could not find or load main class

java spring gradle build.gradle

I'm trying to run a very simple project using Gradle and running into the following error when using the gradlew run command:

Import huge csv file into neo4j

csv neo4j cypher bulk

I am aware of the Import tool but in my case i have to read a row and break it down into nodes and relationships . Using the load csv query with periodic commit with indexes and ,to import 2Million...