Eclipse & EGit Frustrations
Every developer has times when their frustration is overwhelming. This just happened to me when trying to create a new Eclipse project from GitHub and using the EGit plugin for synchronization with a remote repository.
To create a project from GitHub, sources tell me you just have to do the following:
- Select "File -> Import" from the menu and from there go inside the tree structure to "Git -> Projects from Git"
- Then you have to enter a URI like https://github.com/nextreports/nextreports-engine. 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 make it work. I tried, but another error:
I found that other people where successful when using HTTP instead of HTTPS. So, using a url like http://github.com/nextreports/nextreports-engine.git showed me the master branch. Hurray, I said!
The wizard from Eclipse, after sources download, asked me to create the project. When I entered a custom path, 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 a build path and making it compile, I tried to use the EGit plugin to synchronize with my 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 the command prompt to pull and push my work.
When I had time to investigate further, I started to look again because my frustration grew bigger. The project had Ivy dependency management and Ivy resolving or refreshing when it was not working from Eclipse, leaving me no choice other than to use Ant commands from the command prompt. Eclipse had essentially become a simple editor ... Everything I needed to do required using command prompt commands.
Looking inside my 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. The library could be accessed with no problem from the browser. After another search, I saw the big picture:
Our Maven library had a URL with HTTPS! Retrieving libraries through HTTPS did not work. This made me return to proxy settings, and I saw that a 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 projects using a link with HTTPS
- Eclipse Ivy resolving / refreshing
- EGit synchronization with a 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 the Eclipse.ini file (-Dhttp.proxyPort=... -Dhttp.proxyHost=...) I realized that those plugins with https inside their URIs were the culprit.
It was only a proxy setting that 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.