2

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: enter image description here

Jojodmo
  • 23,357
  • 13
  • 65
  • 107
user3642449
  • 51
  • 1
  • 1
  • 9
  • How are you importing? Are you importing it as a maven project? Are you using some maven plugins to setup the classpath? Or are you running via Maven via command line w/ "mvn eclipse:eclipse"? It looks like a classpath setup problem. – Boon Mar 25 '15 at 01:30
  • As I want to keep it on the GitHub I'm going to Import -> Git -> Projects from Git – user3642449 Mar 25 '15 at 01:36

2 Answers2

2

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.

0az
  • 350
  • 7
  • 18
  • I forgot to mention this: Clone first using a shell, then follow my instructions. It's easier to use GitHub for Windows/Mac than to use eclipse's built in git plugin in my opinion. If necessary, use Git shell from the Command Line for rebasing and other stuff. – 0az Mar 25 '15 at 01:53
  • Not sure if this will help but here. http://i.gyazo.com/3e498f59870d473dedc88c945a6764d4.png – user3642449 Mar 25 '15 at 02:07
2

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.

Mavlarn
  • 3,807
  • 2
  • 37
  • 57
  • So this kinda worked. It got me to this stage with a new error. http://i.gyazo.com/311c49eaf61fcb8cd741f28cb19a7810.png – user3642449 Mar 25 '15 at 02:20
  • Did you modify something in build path in project properties? When a maven project is imported, and java source directory is 'src/main/java'. As the project you imported. But in your error message, it is trying to find 'src/java' or 'swornguns/src/java' . – Mavlarn Mar 25 '15 at 02:24
  • So with a fresh new import no changes no nothing this is the file structure http://gyazo.com/82080559cd20d92eef3e1608caa644ec I have errors in most classes and also when I run it I get this error "org.bukkit.plugin.InvalidPluginException: Cannot find main class `net.dmulloy2.swornguns.SwornGuns'" The reason I moved the one before was because it got rid of the errors in all the classes. – user3642449 Mar 25 '15 at 02:33
  • I didn't know about that project and how it should run, maybe it needs some maven plugin or some other dependency. You can try to google it. Like this I found: http://www.spigotmc.org/wiki/spigot-maven/ . From the compile error, you can see what is missed. And try to find the related jar as maven dependency. – Mavlarn Mar 25 '15 at 02:43