1

I frequently have the problem, that I need customized snapshot releases of some open source artifacts contained in the Apache Snapshot or Sonatype Snapshot repositories. A nice way would be to deploy those customized artifact in my private Nexus repository.

How can I ensure that always my customized artifact gets fetched by Maven regardless, whether there is a newer snapshot in the public repositories? This means: Always take the artifact from the hosted snapshot repository when a match is present and use the public ones otherwise.

Herr-Herner
  • 491
  • 6
  • 22
  • Why do you need to use snapshots? Why not using the released versions? – khmarbaise Jan 05 '17 at 07:34
  • In most cases a release has not taken place but the snapshot already contains important bug fixes or new features. Waiting for a public snapshot release sometimes takes too long. – Herr-Herner Jan 05 '17 at 08:38

1 Answers1

2

Avoid to reuse Maven coordinates (group, artifact, version) if you have "patched" the artifact.

Either use a different artifact name (something like commons-io-patched) or add something like this to the version number. Then it is easy to distinguish your artifact from the official one.

Note that changing the version number (e.g. from 1.0.0-SNAPSHOT to 1.0.0-patched-SNAPSHOT) allows Maven dependency mediation to step in, i.e. if you use the patched and the official artifact simultaneously (maybe transitively) only one of them will be included into the build (which is probably what you want).

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • This solution sounds good too me, because it ensures uniqueness among the official snapshots artifacts and my customized ones. Thanks! – Herr-Herner Jan 05 '17 at 10:12