How can I make eclipse make use of packages downloaded by maven?

こ雲淡風輕ζ 提交于 2019-12-11 00:12:31

问题


When I use Maven compile, it will automatically download the depended java packages for me. Now, to debug the project, I import the project into Eclipse, but in Eclipse, the depended package is still missing. How can I get the packages? Or, can Eclipse use packages downloaded by Maven?


回答1:


You don't really need to manually add all the dependencies downloaded by maven to the classpath in Eclipse. There is a maven-2-eclipse plugin which integrates maven with Eclipse. Using that plugin you can

  • import/create a project as Maven project or
  • convert an existing project into a maven project

Your Eclipse will automatically add all the downloaded dependencies on the class path everytime.




回答2:


An alternative to the m2e eclipse maven plugin suggested by rocketboy is to use the maven eclipse plugin. This works from the command line (mvn eclipse:eclipse), and generates Eclipse settings for your project by downloading dependencies and putting them onto the Eclipse build path.



来源:https://stackoverflow.com/questions/18284714/how-can-i-make-eclipse-make-use-of-packages-downloaded-by-maven

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