Pritesh Shah
Pritesh Shah

Reputation: 887

Shared Maven Repository across developers

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?

Upvotes: 11

Views: 12450

Answers (5)

ogzd
ogzd

Reputation: 5692

I think you are looking for https://jfrog.com/community/open-source/

Artifactory has nice user-guide and easy to understand. I have not much experienced it but it is really powerful.

Upvotes: 1

MrsTang
MrsTang

Reputation: 3119

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.

Upvotes: 12

Aliaksei Bulhak
Aliaksei Bulhak

Reputation: 6208

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

Upvotes: 2

Alex M
Alex M

Reputation: 136

Maven is resolving and updating dependencies. You´ll always have a local instance of your repo somewhere. You can configure the local repository and other profiles in the settings.xml in your .m2 folder.

For example the local repo looks like

<localRepository>C:/dev/.m2/repository</localRepository>

It probably also resolves shared filesystems. You can also add an internal repository for your own maven artifacts on a fileshare as

<repository>
     <id>internal.releases.upload</id>
     <name>Internal repo</name>
      <url>file:////data/repo</url>
</repository>

for example. Read more about repositories here http://maven.apache.org/guides/introduction/introduction-to-repositories.html

Upvotes: 0

Festus Tamakloe
Festus Tamakloe

Reputation: 11310

I understand what you want but i sure you that this is not a good idea. Because later conflit will happen as soon as 2 developer start working at once on same project

Upvotes: 0

Related Questions