简体   繁体   中英

Import Java project from GitHub to Eclipse

I'm trying to import a project on GitHub into eclipse because there are a few things I want to add to it. However whenever I add it I get a ton of errors and problems with it...

The GitHub project is https://github.com/dmulloy2/SwornGuns

I've tried adding it to eclipse and it didn't work. I then tried making a project in eclipse and then put the files in, that didn't work. I also read online that going to Configure -> Convert to Maven Project would work, and then importing the spigot.jar file that this source depends on. However that didn't work and just gives me a ton of import errors.

The errors I am getting: 在此输入图像描述

That project is a maven project. A simple way is clone that project into your machine, and import it as a maven project, with File - Import - Maven - Existing Maven Project.

Eclipse will help you resolve the pom file and configure project and download necessary libs.

First, make sure you are using Luna, the most recent version.

In eclipse, File > Import > Git > Projects from Git > Existing Local Repository. In the Import Projects from Git screen, click add, then goto the location of the cloned repository. Click open, finish, then next. Select Java > Java Project, and click next again.

At this point, there are three options.

  1. Import existing projects
  2. Use the New Project Wizard
  3. Import as General Project

Pick "Use the New Project Wizard". Then, uncheck "Use Default location", and click browse. Select a folder (You probably want the location you cloned the repo to), click "Open", and give the Project a name. Click next, and make sure that the src/bin folders are setup correctly, and click finish.

Whew!

Of course, the Import from Git option was only added in Luna, so update eclipse if necessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM