Importing a Maven project into Eclipse from Git

前端 未结 14 1550
误落风尘
误落风尘 2020-12-02 06:04

How can I get the effect of choosing to import from both Maven and Git and have Eclipse properly generate my project?

To get my project into Eclipse I can choose Fi

相关标签:
14条回答
  • 2020-12-02 06:54

    I would prefer to import projects into Eclipse as maven projects rather than git project. Doing this will still allow the project contents to be recognized as git contents. You can continue to perform git operations from Eclipse. As you have mentioned the reverse is not true.

    The nature of a project in Eclipse is not based on the SCM which holds the project, but on the type of project - whether war or jar, etc. - which is automagically determined when the project is imported as maven project.

    I would be hesitant to check-in to SCM IDE-specific metadata. Doing so assumes a lot of things - all developers are using the same IDE or version of the IDE, perhaps same version of JDK/JRE, that they continue to use the same version throughout the project lifecycle and so on.

    0 讨论(0)
  • 2020-12-02 06:55

    Step 1 : Setting Up Eclipse

    First of all you'll need to have a few Eclipse plug-ins installed. So use eclipse IDE software install feature in the help dropdown menu → Install new software, and add link to Available Software Site, then install it.

    1. GIT plugin (EGIT)- http://download.eclipse.org/egit/updates
    2. Eclipse Maven plugin (M2Eclipse) - http://download.eclipse.org/technology/m2e/releases
    3. Maven SCM Handler for EGit (m2e-egit)

      Install from the M2E Marketplace (Settings → Maven → Discovery → Open Catalog and search for " m2e-egit")


    Step 2 : Clone the repository

    Clone(download) your Maven Projects from Git

    Check out non-eclipse Maven Projects from Git (File → Import.. → Maven → Check out Maven Projects from SCM)

    File → Import.. → Maven → Check out Maven Projects from SCM

    Now add your git repository link to SCM URI field.Then click next & finish.

    0 讨论(0)
  • 2020-12-02 06:59

    Direct answer: Go to Files>>Import>>Git>>Project From Git (you should have GIT installed on Eclips)

    0 讨论(0)
  • 2020-12-02 07:02

    I have a maven project with three submodules that is managed in git. I set them up in eclipse as follows:

    1. I registered the git repository with eclipse using EGit
    2. I imported the projects as existing Maven Projects
    3. For each project, I went Team | Share Project.
    0 讨论(0)
  • 2020-12-02 07:03

    Import without installing any additional connectors for Mylyn:

    1. Open Git Repositories view (Window->Show view->Git Repositories)
    2. Press Clone a Git Repository button and proceed with all steps
    3. In newly created repository expand Working Directory, right click on folder with your project and select Import Projects. Then either choose Import existing projects, or select Import as general project. If needed after importing right click on your project and select Configure->Convert to Maven Project (and Maven->Update Project).
    0 讨论(0)
  • 2020-12-02 07:03

    You should note that putting generated metadata under version control (let it be git or any other scm), is not a very good idea if there are more than one developer working on the codebase. Two developers may have a totally different project or classpath setup. Just as a heads up in case you intends to share the code at some time...

    0 讨论(0)
提交回复
热议问题