Question

My team are currently adopting the maven approach to project builds and dependency management.

Do I need to create a snapshots repo and a releases repo is this necessary given it appears the pom file can be written in such a way that snapshots can be ignored?

<repository>
  <releases>
   <enabled>true</enabled>       
   <checksumPolicy>warn</checksumPolicy>
  </releases>
  <snapshots>
   <enabled>false</enabled>      
   <checksumPolicy>fail</checksumPolicy>
  </snapshots>
  ...
 </repository>

I am also interested in any approaches to repository management such as repos for every project separately or many small repositories (3rd party repo, in-house repo ) etc

Thanks

Was it helpful?

Solution

The main reason for separate repositories is that something can go wrong. It if goes wrong in your snapshot repo, you can simply delete and rebuild it. No sweat. Also, since you're going to use the snapshot repo all the time, you're more likely to learn all the things that you shouldn't have done at low cost (made a mistake? Just delete it).

With that experience under your belt, you're much better prepared to make a successful deployment to the release repo. The most important thing about a release repo is that fixing mistakes in there is very hard, sometimes impossible. You can't simply delete things or re-upload them because all the clients will ignore changes to artifacts that they already have, for example. So you can always only ever add to the release repo.

I've also had good experience with 3rd party repos since they keep things separate that come from different sources.

To avoid having 500 different repositories in all your POMs, you either have to move them to a shared parent POM that everyone has to use or you use a repo server like Nexus which can bundle several repos under a single URL.

That means: All clients will download artifacts using a single URL. When you deploy to the proxy server, you use two URLs (one for snapshots and one for releases).

Note: Your code snippet above contains a bug: <updatePolicy>never</updatePolicy> is wrong for snapshots (and for releases, too)

OTHER TIPS

Usually you have only one repository manager (for example nexus) for the entire company. The manager will manage the different repos for snapshots, releases and 3rd party artefacts.

Repositories configuration is usually set in the parent pom company.

Repository manager also allow to cache the artefacts from central and 3rd parties repository to save brandwith usage and improve access time.

see http://books.sonatype.com/nexus-book/reference/confignx-sect-manage-repo.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top