How to import a GIT non-Eclipse Java project into Eclipse?

后端 未结 6 473
一生所求
一生所求 2020-12-02 06:54

I have some problems importing a Java project into my workspace. I am following this tutorial - however I can not use the final Import existing projects ste

6条回答
  •  星月不相逢
    2020-12-02 07:20

    It is possible by first cloning the repository and then creating a General project based on that. Then you can convert it to Java project. Here is how:

    • First go to File>Import...>Projects from GIT.
    • In the Select a Git Repository view you first press Clone. And follow instructions. This will create a local "checkout" of the repository to your computer. You can set the folder to be your workspace so it looks like any other of your eclipse projects.
    • After you have cloned the repository you get back to Import-view. Now you can select the repository you just cloned from the list.
    • Click Next and select Import as General Project. Now you have a git repository to eclipse.
    • Convert it to Java project: Add nature and buildCommand elements from other Java project to your .project file:

    Relevant sections from .project:

    
        
            org.eclipse.jdt.core.javabuilder
            
            
        
    
    
        org.eclipse.jdt.core.javanature
    
    

    Then from Project>Properties>Java Build Path>Source add your source folders (and possible libraries).

    Edit: Added the conversion to Java project.

提交回复
热议问题