How to deprecate a library in Eclipse/Maven/Nexus?

丶灬走出姿态 提交于 2021-01-27 04:23:33

问题


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.


回答1:


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.




回答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.




回答3:


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.



来源:https://stackoverflow.com/questions/19998558/how-to-deprecate-a-library-in-eclipse-maven-nexus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!