Wednesday, 16 October 2013

Eclipse & EGit Frustrations

Sometimes any developer has his moments when a feeling of frustration becomes overwhelming. This just happened to me when trying to create with Eclipse a new project from GitHub and using EGit plugin for synchronization with remote repository.

To create a project from GitHub sources you just have to do the following:
  1. Select "File -> Import"  menu and from there go inside the tree structure to  "Git -> Projects from Git"
  2. Then you have to enter the URI like . Here the first problem arose. I  could not go further because I received an error:

I knew I was behind a proxy and that I had it set. So I started to look for what people had to say. I found that you should add .git at the end of the url to work. I tried, but another error:

 I found that other people where successful by using http protocol instead of https. So, using a url like showed me the master branch. Hurray, I said!

Wizard from eclipse, after sources download, asked me to create the project. Because I entered a custom path, now I got another error (the following picture was taken from another project, so do not look at the name):

So the wizard is also buggy! OK. I closed the wizard and I created the project from scratch from downloaded sources. After setting build path and making it compile, I tried to use EGit plugin to synchronize with repository. A new error popped-up:

This told me that I could synchronize only with my local repository, but not with the remote git repository because fetch failed. Why? It didn't say.

I felt so frustrated after looking around for hours. Because I really needed to do some work and not just configurations, I gave up and I started to use git commands from command prompt to pull and push my work.

When I had time to investigate further, I started to look again because frustration grew bigger. Project had an Ivy dependency management and Ivy Resolving or Refreshing where not working from Eclipse, letting me no choice just to use ant commands from command prompt. Eclipse started to look just as a simple editor ...  Everything I needed to do requested using command prompt commands.

Looking inside Ivy console, helped me to see a "Connection timeout" for a specific library. This was just our engine library added to maven central repository through sonatype. Library could be accessed with no problem from browser. After another searching time, I just realized the big picture:

Our maven library had an url with https! So retrieving libraries through https did not work, only through http. This made me return to proxy settings and saw that proxy was indeed set, but only for http. So I edited the HTTPS entry and I added the proxy to it:

After that everything started to work:
- creating git project using link with  https
- Eclipse ivy resolving / refreshing
- EGit synchronization with remote git repository

And as a bonus, sometimes a plugin from eclipse could not be installed on my computer. This forced me to add the proxy settings directly to eclipse.ini file (-Dhttp.proxyPort=... -Dhttp.proxyHost=...) I realized that those plugins with https inside their URI were the culprit.

So, just a proxy setting caused so much trouble in so many places inside Eclipse.  Sometimes, solving a problem can take just a second, but only after hours or days of frustration.

No comments:

Post a Comment