如何在Eclipse中添加Maven依赖项? [英] How do I add a Maven dependency in Eclipse?

查看:170
本文介绍了如何在Eclipse中添加Maven依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根本不知道如何使用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.

    解决方案

    1. On the top menu bar, open Window -> Show View -> Other
    2. In the Show View window, open Maven -> Maven Repositories

    3. In the window that appears, right-click on Global Repositories and select Go Into

    4. 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
    5. 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屋!

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