0

I'm having some conceptual difficulties understanding how Eclipse works.

I've got a project for an Android application, which I created using the ADT wizard. Things I see in the Projects panel in Eclipse more or less resemble the contents of the filesystem directory which was generated in ~/workspaces/MyProjectName, so I suppose that what I see in Eclipse is more or less a reflection of the filesystem.

Now I want to add some subproject/library which I checked out from github (as a git submodule) into a sub-directory inside ~/workspaces/MyProjectName. I also edited classpath.xml to point to the new location, hoping that Eclipse will read the file, see the new location and everything will work.

However, this didn't happen, the directory never appeared in Eclipse and Eclipse tried to pretend that it doesn't exist at all (i.e. not allowing me to build the project which referenced the code from the new directory etc.)

I tried to add the directory to the folder manually inside the project, but Eclipse complained that the directory already exists in the filesystem so it created nothing.

Obviously I'm doing something wrong :)

The questions are:

  • Am I supposed to do everything via Eclipse, including file operations, working with VCS etc.? I'm fairly proficient with terminal and would not want to have to figure out how to do everything via a point-and-click interface.

  • Is there a sane way to make Eclipse to re-read the project structure from the disk?

  • Where does Eclipse store its settings for each project? I was hoping to be able to make the project self-contained, so I can check it out on any machine and be able to work without having to manually re-configure stuff in Eclipse, but that would not work if Eclipse stores its configuration for the project somewhere outside the project's directory.

4

2 回答 2

3

我应该通过 Eclipse 做所有事情吗

不,你可以,但没有什么能强迫你这样做。

有没有一种理智的方法可以让 Eclipse 从磁盘重新读取项目结构?

  • F5 用于在选择项目、文件夹或包时进行刷新。
  • 如果您至少有 3.7 Eclipse 版本,则启用“访问时刷新”
  • 如果某些资源未列为项目的一部分,则重新导入项目

Eclipse 在哪里存储每个项目的设置?

.project位于项目根文件夹中文件系统上的文件。

但这不是编辑器、视图等的配置。这就是工作空间配置,它存储在.metadata工作空间根目录下的文件夹中的文件系统中。


我不确定您是否混淆了 Eclipse 中的某些概念,并且我的回答实际上解决了您的意思。

您还可以从现有项目或文件系统导入项目,如果您不希望每次创建新工作区时手动重置配置,也可以导入备份配置。

关于 VCS 和其他东西,您可以安装插件(您使用哪个 VCS?)或从命令行或外部工具执行操作。例如,许多人会为 Subversion 使用 Eclipse 插件(通常是 subclipse 或 subversive),或者使用外部命令行或 Windows shell 的 TortoiseSVN 扩展。

于 2012-06-06T02:16:05.330 回答
0

这可以帮助你(导入>常规>文件系统)

http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Freference%2Fref-70.htm

于 2012-06-06T02:17:27.810 回答