Eclipse - 导入现有项目?

18

我有一个项目,想要将其添加到我的工作区。但是Eclipse无法检测到我指向的目录中的新项目。

我该如何让Eclipse知道特定目录包含一个项目?

我的目录包含:

  • assets
  • libs
  • res
  • src
  • bin
  • gen
  • AndoridManijest.xml
  • proguard.cfg
  • project.properties
5个回答

14
您只需进行导入->现有项目到工作区,然后浏览至您的项目所在位置的.classpath和.project文件即可。

没有.classPath或.project文件。我尝试创建一个全新的项目,但仍然找不到这些文件。 - aryaxt
1
如果我理解得不对,请纠正我。您正在尝试导入一个由其他人从他的Eclipse工作区导出的项目。如果是这样,它们应该在顶级目录中。如果不是,1)这不是一个Eclipse项目?那么你怎么能指望Eclipse知道有一个它可以识别的项目呢?2)如果它应该是一个Eclipse项目,那么导出的人一定搞砸了。 - FUD
谢谢,问题已解决。我将项目内容从一个目录复制到另一个目录时,没有复制.classpath和.project文件。这两个文件是隐藏的,所以我以为它们不存在。我将它们复制到新目录中,问题就解决了。 - aryaxt

11

针对Eclipse的新版本,选择文件 > 导入 > 常规 > 从现有项目导入到工作区


1
这就是我需要的信息。谢谢。 - Marcel Marino
非常欢迎 :) 你可能想试试Netbeans。我发现它比Eclipse更容易使用。这只是另外一种在Eclipse-Netbeans争论中的声音 :) - Nav
嗯……我以前在使用 PHP 时确实用过 NetBeans。我不太记得那个经历了。 - Marcel Marino

2

就像这样

   Importing existing projects
    You can use the Import Wizard to  command link import an existing project into workspace.

    From the main menu bar, select  command link File > Import.... The Import wizard opens.
    Select General > Existing Project into Workspace and click Next.
    Choose either Select root directory or Select archive file and click the associated Browse to locate the directory or file containing the projects.
    Under Projects select the project or projects which you would like to import.
    Click Finish to start the import.

0

如果您无法像某些上面的解决方案那样导入项目,您应该创建一个新项目,名称为要导入的项目名称。记得将您导入的项目放到工作站中。


0

这个解决方案适用于eclipse。

当我从命令行克隆来自Bit Bucket的存储库时,会将其克隆到本地存储库,因此上述解决方案不起作用,因为它会说文件已经在本地存储库中。

解决方案:

1. Window > Show View > other > Git repositories
2. Right Click on the git repository tab > import projects
3. navigate to the repository you want to put into eclipse
4. select the third option 'import as general project', if selecting this does not work then view other options and select the option that applies to you
5. finish

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接