News Ticker

Java EE Project From Remote GitHub Repository


This article shows how to create a new Eclipse project from a remote Git Hub repository.  You will learn:

  1. how to download and install eGit for eclipse,
  2. how to check out a Git Hub repository from a remote site and
  3. how to import a Marven project.

This article assumes that you have the Java EE Kepler version of Eclipse, a Git Hub account that contains a repository that you want to check out and that the project has a POM file (i.e. is a Marven project).

I often post about Java EE on Twitter. Follow me here

Download and Install eGit for Eclipse.

To install eGit follow these steps:

  1. Navigate to Eclipse > Help > Install New Software. You will see a dialogue box like the one below.
    git step 0
  2. In the work with drop down select the Kepler site.
  3. Then expand the option Collaboration and tick the three option name as follows
    1. Eclipse EGit
    2. Eclipse EGit Mylyn GitHub Feature
    3. Eclipse JGit
  4. If these options are not available it is because they are already installed
  5. Click through the rest of the wizard and agree with the licenses. The eGit plug-ins will now be downloaded and installed.
  6. If you are asked to restart Eclipse do so.

Check out a Git Hub Repository From a Remote Site

Now we will check out a project from the Git Hub remote server. It is assumed that you have a Git Hub account and a project ready to be checked out. For this part of the article, you will need your user name and password for you Git Hub account and the URL of the repository.

  1. You will need to open the Git Repository Exploring perspective. Navigate to Eclipse > Window > Open Perspective > Others and select the Git Repository Exploring perspective.
  2. The Git Repository Exploring perspective tab should appear on the toolbar next to the Java EE perspective tab.
  3. Click on the Git Repository Exploring perspective tab. You should see the three options as follows:
    1. Add an existing local Git repository
    2. Clone a Git repository
    3. Create a new local Git repository
  4. Click the Clone a Git repository to reveal the Source Git Repository dialogue box
    git step 1
  5. In this dialogue box enter the URL of the repository. This can be found on the home page of the project in your Git Hub account. At the time of writing it was located to the right of the page under the title HTTPS clone URL.
  6. Copy this URL to the clipboard and paste it into the URI.
  7. In the authentication, section enters you Git Hub username and password and click the Store in Secure Store tick box. Click Next.
  8. On this screen we select the master branch (or another branch if appropriate). Click Next.
    git step 2
  9. Next, we select the local destination for the repository. Click Finish.
    git step 3
  10. Now the repository is checking out to your local computer. This will take a few minutes depending on the size of the project. Once it has finished you will see your repository displayed in the list of Git Repositories.
    git step 4

Import a Marven Project.

Now we need to import the project.

  1. Navigate to Eclipse > File > Import and from the dialogue box that pops up select Existing Marven Project.
    git step 6
  2. Now you need to select your Marven project. Navigate to the location given above step Local Destination. In the projects section, you should see your project. Select it and click Finish.
    git step 7
  3. The browser will create a new project and import all of the idependencies. This may take some time. You may see the following dialogue box on the screen while it is preparing the project.
    git step 8
  4. Once all the dependencies have been imported you can build your project.

This has been a very quick guide to checking out a remote Git Hub project in Eclipse.

Further Reading Material

If you are interested in HTTP/2 and the changes that it implies you might like my article explaining what HTTP/2 is all about.

If you are interested in good coding practice then my article Clean Code: Variables should be interesting.

You can learn about Cloud based deployment pipeline and how to move your entire development pipeline to the cloud in my next article.

If that interests you then my tutorial Amazon Free Usage Tier: Installing Tomcat 7 on an EC2 Linux instance should be interesting also.

Follow Me

I often post about Java EE on Twitter. Follow me here

2 Comments on Java EE Project From Remote GitHub Repository

  1. Okay very well, but what is the best practice for structure git project java ee?,
    only one repo for all projects
    project.war——–> only one repo(project.ear,project.war,project.jar)?
    project.jar ——

    or single repo for single project ?

    project.ear—— > only one repo
    project.war——–> only one repo
    project.jar ——> only one repo

  2. Single repository for single project

Leave a Reply

%d bloggers like this: