1

My problem currently is that I've got a project on bitbucket, and I've been able to create a local repository of the project through Eclipse.

However, when attempting to import the repository into Eclipse to run the project I come up against a couple of issues.

  1. Create a new project from the git repository. This does create a new project and links it to the local repo, but I'm not able to run is as a java project. The reason being that all of the options under the 'run configurations' are blank. And Eclipse doesn't recognise the project as a project at all.

  2. Create a java project first, and link it to the repo such that I can do push and pull to the repo. No idea how.

Any help would be hugely appreciated.

TheMightyLlama
  • 1,243
  • 1
  • 19
  • 51

2 Answers2

1

For option 1/, it could be as simple as to add the Java Nature to your current project (as seen also here).

Regarding the option 2/, you could create your java project, and then:

  • delete the project from your workspace (soft delete only, you wouldn't delete the files on the hard drive)
  • move the project files (ie .the .project, .classpath and sources) to the local git repo
  • import that project (in its new location) in your Eclipse workspace.
  • right click on them, select Team-> Share-> Git (and select your Git repo location), in order to mention to Eclipse that this project is managed by Git.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Good tutorials on Egit: http://www.vogella.de/articles/EGit/article.html and http://wiki.eclipse.org/EGit/User_Guide – VonC Mar 05 '12 at 08:52
  • that did the trick. I was missing the .project and .classpath files in the repo. Which was why I couldn't execute it as a java app. – TheMightyLlama Mar 05 '12 at 09:01
  • @user1249379: Excellent! Creating a Java project (ie generating the right `.project` and `.classpath`) and then copying said project files in your Git repo is certainly easier than trying to add Java nature to those same files (as described in http://stackoverflow.com/questions/8070017/how-to-import-a-git-non-eclipse-java-project-into-eclipse). – VonC Mar 05 '12 at 10:12
0

I think importing the repository into Eclipse and running the project are different things.

To simplify the process, I always use "git clone xxx" to get a local repository. Then add an existing local git repository into Eclipse and create an existing java project from the cloned git repository respectively. In this way, I can run my project and control the repository.

Bruce
  • 118
  • 1
  • 8