Is there any way to avoid developers download all dependencies and have those dependencies located to shared locattion to all the developer and each developer working on project point to that location?
Can anyone explain with sample files and example?
In Maven terminology, a repository is a directory where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily.
m2 folder is the default folder used by maven to store its: settings. xml file which specifies properties, like the central repository to download your dependencies, the location of the so-called localRepository. by default, the localRepository in which maven stores all the dependencies your project might need to run.
There are 3 types of maven repository: Local Repository. Central Repository. Remote Repository.
Mirror means a repository that is used as a passerelle/proxy to an other repository. When using a repository manager like Nexus, Artiafactory, Archiva... you dispose of one local entreprise repository wich proxifies remotes ones. So there is no need to declare too many repositories in your pom or setting.
Best is to go with one of the repository managers for maven. The main steps for the setup will be: - Install a central repository on an internal machine - Configure the central repository to proxy the repositories you need for your developers - Modify the developers maven settings to use the internal maven repository as mirror for everything (see here for details)
There are 3 well-known repository managers available:
I favorite Artifactory - the installation and configuration took less than an hour. Now if a developer adds a new dependency to a maven project, the artifact will be downloaded from the original remote repository to the internal repository and will be made available. When the next developer needs the archive it will be downloaded from the internal repository - the access will be much faster.
You can change local repository like this:
The location of your local repository can be changed in your user configuration. The default value is ${user.home}/.m2/repository/.
<settings>
...
<localRepository>/path/to/local/repo/</localRepository>
...
</settings>
look this article
I think if you make shared folder and all other developers write path to this folder this can help.(but I didn't try this)
UPDATE
Using shared repo is bad idea. Sharing local repository between two or many users is not thread safe and may result in different errors.
So as many people mentioned here use Artifactory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With