7

We use Eclipse + Maven plugin to get library from Nexus, it's good. And we also put our internal library on Nexus.

When we release a new version of a library to Nexus, we want to let old version to be "deprecated", is it possible? For example, when use use Eclipse's Maven plugin, he choose the old version and Eclipse shows "it's deprecated".

Because some old systems still need the old version, we cannot remove it from Nexus directly. But we don't want new systems to use old version.

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
Dennys
  • 587
  • 2
  • 13
  • 33

3 Answers3

5

You can add a rule via the maven-enforcer-plugin to prevent using older version but only via a company pom which has to be used by all new projects.

kryger
  • 12,906
  • 8
  • 44
  • 65
khmarbaise
  • 92,914
  • 28
  • 189
  • 235
2

There is no way to "deprecate" a release in Maven.

The reason for this is that the old release still works - old projects still use it and they are happy. There is usually no need to force projects to upgrade.

Also, Nexus (by default and for good reason) won't let you change the released POM.

What you need is a way to communicate the best version people should use right now. The correct way to do this is a web site. Just add the URL in a <url> element in your POM, so people can easily find it.

Also, you can use mvn versions:display-dependency-updates and mvn versions:display-plugin-updates from the versions plugin to get a list of dependencies with a higher version than you have.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • 3
    What if a library was determined to have a nasty bug that was only caught after its release? It would be ideal to never allow any new projects to compile against that version, or to at least indicate in BOLD letters that this is a deprecated library (the URL could indicate details). – scorpiodawg Nov 05 '15 at 20:30
  • This sounds like a reasonable scenario but doesn't change how Maven works. There simply is no official way to "annotate" or change a released POM. See also: https://stackoverflow.com/questions/9789611/removing-an-artifact-from-maven-central – Aaron Digulla Nov 06 '15 at 12:25
0

You don't want to remove it from Nexus. What happens if someone wants to build an old version of your software ?

I would rather use Java's method/class deprecation methods, and deprecate old API calls in your new library version.

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440