Skip to content

Importing Git Repos in Eclipse

Adam Treister edited this page Jul 31, 2019 · 8 revisions

This is assuming you have already followed the README to clone the repositories and can get a successful build on the command line using maven.

Installing Eclipse and Adding Git Repo

  • Download latest version of eclipse, probably “eclipse for java developers”, from eclipse.org/downloads.
  • Unpack the archive and run eclipse.
  • Go to the git perspective: Window > Perspective > Open Perspective….
  • In the Git Repositories view, select Add an existing local git repository to this view from the icon options.
  • In the Directory field, enter /your/path/to/git/cytoscape/cytoscape, then click the Search button. (you may need to check the look for nested repositories checkbox). Make sure to choose the second level cytoscape directory -- cytoscape/cytoscape.
  • Select all the cytoscape repositories and click Finish. The Git Repositories view should now look something like this:

Maven plugin for Eclipse

Before you can import the projects into eclipse you need to install the maven-git bridge plugin.

  • Go to File > Import….
  • Select Maven > Check out Maven projects from SCM and click Next.
  • In the dialog click the link that says Find more SCM connectors in the m2e marketplace.
  • Find and select m2e-egit, then install by clicking Finish and then clicking through subsequent dialogs.
  • NOTE: If this fails, try Help>Install New Software... Work with: https://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-egit/0.15.1/N/0.15.1.201806191431/ and then install.
  • Restart Eclipse.

Import Maven Projects

  • Now go back to the Git perspective.
  • We’ll start by importing the API projects.
  • Expand the Working Tree repository
  • Right click on the api directory
  • Select Import Projects…
  • Select all the projects and click Finish -- loading projects may take a while.
  • If you go to the Package Explorer in the Java perspective you should see all the projects, and there shouldn’t be any compile errors. Note: it may take a minute for the folder icons to acquire the maven "M". You can find most Eclipse icons described here.
  • If the Package Explorer shows compilation errors, it could be that the api repository has a defective taglets sub-project. Close the taglets project and rebuild via Project > Clean.

Review and Repeat

Back in the Package Explorer you should now have perfectly functional Java/Maven/Git projects for the api repo. Repeat the process for the impl repository, and maybe also the apps repository -- you probably don’t need the other ones. Everything should work as you'd expect in Eclipse (e.g., content assist, debugging, etc.), although sometimes you get double-hits when doing a file search. If this becomes annoying you can delete (or just close) the xxx-parent projects. In fact, you don’t really need anything that does not end in -api or -impl.

Note: You get the apps repo by running ./cy.sh apps (see main readme). The apps repository has some extra quirks because it uses submodules. Expand the Submodules node and make sure each core app is on the master branch. If not right-click on each one and select checkout and then select the master branch. You can then import them using the above process.

Package Management in Eclipse

Now that you have dozens of projects -api and -impl littering your Package Explorer in Eclipse and two or three closed parent projects, scattered among your other potential projects in Eclipse, you may want to tidy things up a bit:

  • Create a new working set with File > New > Java Working Set.
  • In the creation dialog, move all the projects files you've imported above into this new working set. You might name it somethings like, "Cytoscape3Git", for example.
  • Via the pulldown icon in the upper-right of the Package Explorer, choose Top Level Elements > Working Sets. You should now see your Cytoscape3Git working set, plus "Other Projects" and any other working sets you've made previously.
  • Now you have all the relevant cytoscape project folders in one place. You can now easily see if you have local changes within any of the nested repos of the Cytoscape project from this view.

Git Management in Eclipse

  • To check out code from git, select the Git perspective, select all the cytoscape repositories, right click and select Pull. There’s an extra step to check out code for core-apps, expand the Submodules node and select all the core apps, then right click and select Pull.
  • The Git Staging view is where you will do most of your work with git.
  • Egit is pretty complicated. Here is a link to their user guide.