TheMightyLlama
TheMightyLlama

Reputation: 1273

Using a remote git resource in eclipse for a runnable java project

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.

Upvotes: 1

Views: 621

Answers (2)

Bruce
Bruce

Reputation: 118

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.

Upvotes: 0

VonC
VonC

Reputation: 1323463

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.

Upvotes: 1

Related Questions