Update Maven dependencies automatically

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 05:21:11

问题


I have a significant number of Maven projects in Eclipse, with quite a lot of dependencies.

Some of the dependencies are frequently being updated in repositories as new versions are released. Currently I have to look out for these manually, and manually edit the respective pom.xmls to use the new version.

Is there an automatic way to do the following in Eclipse:

  • Check whether newer versions of each dependency are available?
  • If so, automatically suggest changes to the pom.xml (like a "quick fix" feature)?

回答1:


You are looking for maven versions plugin:

versions:display-dependency-updates Displays all dependencies that have newer versions available.

This will show a list of all updated dependencies. There is a similar command to show a list of all the updated plugins.

There doesn't seem to be a command to update the dependencies to their latest versions automatically. From the docs it looks like you can use the versions:display-property-updates to update the dependency versions if they are specified as properties in the pom file.




回答2:


When using Github you could use the Dependabot GitHub plugin, it generates a pull-request for each dependency needing an update.



来源:https://stackoverflow.com/questions/12551031/update-maven-dependencies-automatically

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