Tuesday, October 29, 2019

How To Import a GitHub Project into Eclipse IDE

How to import a GitHub project into an eclipse project, without polluting the git directory within your user home folder?

Open the command line terminal and move to eclipse workspace:

cd ~/eclipse-workspace

clone the GitHub project from command line:

git clone https://github.com/heroku/java-getting-started heroku-getting-started

You have cloned the GitHub project into the heroku-getting-started directory.

As you can see, this directory does not contain an eclipse project yet:

user@host:~/eclipse-workspaces/heroku-getting-started$ ls -la
total 72
drwxr-xr-x  6 user user 4096 ott 29 12:59 .
drwxrwxr-x 22 user user 4096 ott 29 13:01 ..
-rw-r--r--  1 user user  157 ott 29 12:59 app.json
drwxr-xr-x  2 user user 4096 ott 29 12:59 docs
-rw-r--r--  1 user user   14 ott 29 12:59 .env
drwxr-xr-x  8 user user 4096 ott 29 12:59 .git
-rw-r--r--  1 user user  127 ott 29 12:59 .gitignore
-rw-r--r--  1 user user 1076 ott 29 12:59 LICENSE
drwxr-xr-x  3 user user 4096 ott 29 12:59 .mvn
-rwxr-xr-x  1 user user 6509 ott 29 12:59 mvnw
-rwxr-xr-x  1 user user 5181 ott 29 12:59 mvnw.cmd
-rw-r--r--  1 user user 3692 ott 29 12:59 pom.xml
-rw-r--r--  1 user user   50 ott 29 12:59 Procfile
-rw-r--r--  1 user user 1113 ott 29 12:59 README.md
drwxr-xr-x  3 user user 4096 ott 29 12:59 src
-rw-r--r--  1 user user   24 ott 29 12:59 system.properties

Now, this directory will soon be the base directory of the eclipse project. Launch eclipse application, select the worskspace to open, and import the project:

To import the project, select the last option in the dialog window: "Project from Folder"

In the file selector, select the folder of the Git project to be imported. This is what you get:

Now the directory does contain an eclipse project, because it holds the .project file and the .settins sub-directory:

user@host:~/eclipse-workspace/heroku-getting-started$ ls -la
total 88
drwxr-xr-x  8 user user 4096 ott 29 13:20 .
drwxrwxr-x 22 user user 4096 ott 29 13:01 ..
-rw-r--r--  1 user user  157 ott 29 12:59 app.json
-rw-rw-r--  1 user user 1236 ott 29 13:20 .classpath
drwxr-xr-x  2 user user 4096 ott 29 12:59 docs
-rw-r--r--  1 user user   14 ott 29 12:59 .env
drwxr-xr-x  8 user user 4096 ott 29 12:59 .git
-rw-r--r--  1 user user  127 ott 29 12:59 .gitignore
-rw-r--r--  1 user user 1076 ott 29 12:59 LICENSE
drwxr-xr-x  3 user user 4096 ott 29 12:59 .mvn
-rwxr-xr-x  1 user user 6509 ott 29 12:59 mvnw
-rwxr-xr-x  1 user user 5181 ott 29 12:59 mvnw.cmd
-rw-r--r--  1 user user 3692 ott 29 12:59 pom.xml
-rw-r--r--  1 user user   50 ott 29 12:59 Procfile
-rw-rw-r--  1 user user  551 ott 29 13:20 .project
-rw-r--r--  1 user user 1113 ott 29 12:59 README.md
drwxrwxr-x  2 user user 4096 ott 29 13:20 .settings
drwxr-xr-x  3 user user 4096 ott 29 12:59 src
-rw-r--r--  1 user user   24 ott 29 12:59 system.properties
drwxrwxr-x  4 user user 4096 ott 29 13:20 target

No comments :

Post a Comment