如何在Eclipse中添加Maven依赖项? [英] How do I add a Maven dependency in Eclipse?
问题描述
我根本不知道如何使用Maven。我用Eclipse开发了几年,但还不需要了解它。但是,现在我正在
在显示的窗口中,右键单击全局存储库,然后选择进入
右键单击 central( http://repo.maven。 apache.org/maven2 )并选择重建索引
- 请注意,完成下载需要一段时间
索引编制完成后,右键单击项目 - > Maven - > 添加依赖项,然后开始键入所需项目的名称导入(例如hibernate)。
- 搜索结果将自动填入下面的搜索结果框。
I don't know how to use Maven at all. I've been developing for a couple years with Eclipse and haven't yet needed to know about it. However, now I'm looking at some docs that suggest I do the following:
"To include it within your project, just add this maven dependency to your build."
<repository>
<id>jboss</id>
<url>http://repository.jboss.org/maven2</url>
</repository>
...
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>1.1.GA</version>
</dependency>
How do I do this with my Eclipse project?
Please assume I know nothing about Maven. I just figured out it might be installed on my computer by typing mvn
on the command line, but that's seriously the extent of my knowledge. I would be happy to continue knowing nothing about Maven if there is an equivalent, non-Maven way of following these instructions with Eclipse.
- On the top menu bar, open Window -> Show View -> Other
In the Show View window, open Maven -> Maven Repositories
In the window that appears, right-click on Global Repositories and select Go Into
Right-click on "central (http://repo.maven.apache.org/maven2)" and select "Rebuild Index"
- Note that it will take a while to complete the download
Once indexing is complete, Right-click on the project -> Maven -> Add Dependency and start typing the name of the project you want to import (such as "hibernate").
- The search results will auto-fill in the "Search Results" box below.
这篇关于如何在Eclipse中添加Maven依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!