How to configure a project imported from GIT to be a Java project in Eclipse?
I’ve imported a project from Git in Eclipse using this method:
File > Import > Git > Projects from Git > Next > Clone URL .
At this point I inserted the URI like this https://github.com/mygituser/My-Project .
Then my user and password, and the project was imported.
The problem is that Eclipse didn’t recognize it as a Java project, and I really don’t know why.
As consequence, I can’t see errors or warnings on my project and neither use autocomplete, I’m getting this message “This compilation unit is not on the build path of a Java project”.
Also, right click on My-Project > Build path shows the message “No actions avaliable”.
If you need more information to help me, could you ask me on comments, please?
I appreciate your attention!
2 Solutions collect form web for “How to configure a project imported from GIT to be a Java project in Eclipse?”
Most people don’t include build files in repositories, only source. What you need to do is create a new Eclipse project the create a Git repo on top of that:
- Create a new Eclipse project, and go to it with your terminal.
git initto initialize a repo.
git remote add origin https://github.com/mygituser/My-Projectto add the remote.
git pull -u origin masterto pull the changes.
Also, make sure that when you commit, you don’t add build files that the author kept out. You can do this via a
.gitignore file. Simply take this file and add it to your project directory.
This method applies to most Git repositories, as build and compiled files are usually left out.
Note that this method requires that you install Git for command line (or Git Bash). You can get Git at their website.
Since you already have the source code downloaded from the git repository, you should be able to create an Eclipse project from the existing source code.