如何将依赖项从pom加载到eclipse项目的classpath中? [英] how to load the dependencies from the pom into classpath of eclipse project?

查看:258
本文介绍了如何将依赖项从pom加载到eclipse项目的classpath中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Am使用带有m2eclipse插件的eclipse helios.对于从CVS中签出的Maven项目,我如何告诉eclipse从pom中提到的依赖项中自动获取该项目所需的所有jar.

Am using eclipse helios with m2eclipse plugin. For a maven project checked out from CVS, how do i tell eclipse to automatically fetch all the jars needed for that project from the dependencies mentioned in the pom.

感谢您的时间

推荐答案

m2eclipse应该为您做到这一点(相关性将复制到您的本地存储库中)并构建有效的类路径. 我对已解决的依赖关系已经过时的尝试有任何疑问

m2eclipse should do this for you (dependencies will be copied to your local repository) and build a valid classpath. I you have any doubts that the resolved dependencies are outdated try

<select project> -> Context Menu -> Maven -> Update Dependencies

如果要保证所有依赖项(和插件)都在本地存储库中,则可以运行 Maven依赖插件:

If you want to guarantee that all dependencies (and plugins) are in your local repository you can run the go-offline goal from the Maven Dependency Plugin:

mvn dependency:go-offline

如果要将所有需要的依赖项复制到一个地方,请使用复制依赖目标

If you want to copy all needed dependencies to one place, use the copy-dependencies goal

mvn dependency:copy-dependencies

在这种情况下,Maven依赖项插件会将所有依赖项(包括传递性)复制到target/dependency文件夹中.

The Maven Dependency Plugin will copy all dependencies (including transitive) to the target/dependency folder in this case.

您还可以使用以下命令从eclipse运行所有这些命令:

You can run all these commands also from eclipse using:

<select project> -> Context Menu -> Run As -> Maven build... -> <type goals> -> Run

这篇关于如何将依赖项从pom加载到eclipse项目的classpath中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆