I can’t find a way to automatically deploy dependencies of a maven project on an enterprise repository. Here is my ideal scenario :
- a developer create a maven project
- he adds two dependencies to its project and add a reference to the enterprise repository
- as the dependencies do not exist in the enterprise repo, they are downloaded from central repo
- maven automatically detects it and copy the downloaded dependencies to the enterprise repository
- a second developer create a new maven project
- he adds the same dependencies as the first project
- as the dependencies have been automatically copied to the enterprise repo before, they are downloaded from the enterprise repo (and not the central repo)
The benefits of this approach is that only the first developer who get a dependency will get it from internet. For the next tries, the dependency will be downloaded from the enterprise repo and this is totally transparent for the developper.
Is there a way to achieve this scenario ? If not, what are the alternatives ?
Yes, this is exactly what a maven repository manager does.
The link has information about some of the popular repository managers. These software are fairly easy to install and configure. Some of them also provide commercial enterprise versions which are well supported.
Each developer will specify this enterprise repository as a mirror in his maven settings file. Refer to this detailed guide.