如何在 Eclipse 中加载 Google Collections Library?
我目前正在尝试学习使用 Guava,所以我通过这样做下载了源代码:
svn checkout http://guava-libraries.googlecode.com/svn/trunk/ guava-libraries-read-only
抱歉,如果这听起来真的很愚蠢,但是对于我来说,我不知道如何在 Eclipse 中加载源代码来检查它。我尝试过不同的方法(创建、导入等),但最终总是遇到包问题。
顺便说一句,我在 Ubuntu 上使用 Eclipse 3.5。
我可以得到一些帮助吗?谢谢!
编辑:我正在尝试检查源代码,因此我想将源代码添加为项目。
I'm currently trying to learn to use Guava so I downloaded the source by doing this:
svn checkout http://guava-libraries.googlecode.com/svn/trunk/ guava-libraries-read-only
Sorry if this sounds really stupid but for the life of me, I can't figure out how to load up the source in Eclipse to examine it. I've tried different ways (creating, importing, etc) but always end up with package problems.
I'm using Eclipse 3.5 on Ubuntu by the way.
Can I get some help on this? Thanks!
EDIT: I'm trying to examine the source so I would like to add the source as a project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我的回答可能有点晚了......但您也可以简单地从更新站点“番石榴捆绑";它将安装源代码,然后您只需在工作区中导入插件(文件>导入>插件和片段...不要忘记勾选第一个上的“带有源文件夹的项目”复选框该向导的页面)并从中浏览源代码。
请注意,此更新网站现已停止提供 Guava-osgi 的利润,该网站还提供一个易于安装的更新站点...但我还没有安装它,因此不知道源是否包含在通过此更新站点安装的工件中。
I might be a little late in answering ... but you could also simply install the guava bundle from the update site "guava-bundle"; it will install the sources along and you'll then just have to import the plugins in your workspace (File > Import > plugins and fragment... don't forget to tick the "projects with source folder" checkbox on the first page of this wizard) and browse the source from it.
Note that this update site has now been discontinued in profit of Guava-osgi which also provide an update site for easy installation ... but I haven't installed it yet and thus don't know whether the sources are included in the artifacts installed through this update site.
这是我要做的...
如果您需要源代码,可以通过“配置构建路径”项目菜单或使用“附加”在 Eclipse 中附加
guava-r-src.jar
调试期间的源按钮。Here is what I would do...
guava-r<version>.jar
to your project's lib directory.If you need the source you can attach the
guava-r<version>-src.jar
in Eclipse via the Configure Build Path project menu or by using the attach source button during debug.最简单的方法是从 Guava 网站下载 Jar< /a>,将其复制到您的 Eclipse 项目中,并使用 jar 上下文菜单 > 将其添加到构建路径中构建路径>添加到构建路径。另外,使用“项目上下文菜单”> 将 Eclipse 指向包含的源 zip 文件。配置构建路径...以获取有关 Guava 类的 Javadoc。
It's easiest to download a Jar from the Guava site, copy it into your Eclipse project and add it to the build path using the jar context menu > Build Path > Add to Build Path. Also, point Eclipse to the included source zip using project context menu > Configure Build Path... to get Javadoc on the Guava classes.
我有两种方法:Subclipse 和 Maven Eclipse 插件。两者都提供“从存储库创建项目”之类的选项。这两个插件都有合理的在线帮助,因此我不会在这里重复具体步骤。
从存储库创建项目将为您提供源代码(以及文档、构建文件等)的完整视图。
I have done it two ways: the Subclipse and Maven eclipse plugins. Both offer "create project from repository"-like options. Both plugins have reasonable online help, so I'll not repeat exact steps here.
Creating a project from the repositories will give you a full view of the source (and documentation, build files, etc).