not able to import github project in eclipse - eclipse

just created project on github from my office and when then i came home and was trying to import the project on my home machine but I am not able to do it.
Following is the detail.
Both home and office machine has eclipse Juno and Egit plugin installed. I am able to do check-in from office. but at home I am not even able to import the project.
my workspace directory - c:\gaurang
git local directory - d:\Gaurang\Webdriver-Data-Driven-Framework
Now if i choose "Import existing projects" it says No project found
if i choose "Use the new Project Wizard" - it creates empty project
if i choose "Import as general project" - it creates the project but not a java project so not able to compile or run.
My git repository - https://github.com/Gaurang033/Webdriver-Data-Driven-Framework.git

I struggled in a similar fashion when checking out https://github.com/angular/angular-seed.git
The problem was that I expected to happen in a single step. The Github project does not contain eclipse files, so of course you can not import existing projects - the other options should work, however and they don't
The solution for me was to:
Clone the github repository locally e.g. /home/name/git/angular-seed (import.../Projects from Git/URI)
Obtain a working copy as a plain project (import.../Projects from Git/local)
I think it's a bug
The result is that I have the cloned repository in /home/name/git/angular-seed and a skeleton project with a ".project" file that points to that place

You have to push your .project and .classpath files to the repository if you want to be able to import the project using the "Import existing projects" wizard. If those are not present, eclipse cannot detect an existing java project.

Related

Imported repo does not import the projects within

the title says most of it. I also checked the "Import all existing Eclipse projects after clone finishes". I am starting to learn github. Please help me and make this a pleasent start so I actually keep using it. The repo folder that I had to choose for the repo is not in my eclipse workspace. I thought I don't need to manually import the projects in the repo if I check that checkbox. I use eclipse Mars and EGit.
Edit: I created a new repository before on GitHub. I imported a test project into my repository to play around with it and test stuff. Thats all whats in the repository.
Thats what my GitHub repo looks like on the website:
Apprecciate your help.
Eclipse will only import Eclipse projects. So if you have some plain Java projects (without Eclipse specific meta data) or even just plain folders in your repository, those will not be imported. However, you can import all such non Eclipse artifacts into Eclipse projects by using the "Import -> General" wizard category.
And in case your projects are Eclipse projects, you can re-try the import from the locally cloned repository into your workspace by using the "Import projects" menu on the repository in the repository view of Eclipse.

Importing with EGit clones repository but doesn't let me import project

I just started my third repository on Github. I initialized the repository on the website with a README file and tried importing it into Eclipse with Egit. Like my other projects from Github, the import dialog worked fine and the repository was cloned. In my file explorer, I can see the folder Egit created, as well as the .git folder and the README from the repository.
However, when I get to the point where Eclipse wants me to choose a wizard for project import, everything stops working. I can't import an existing project, because none exists yet. If I try to import it as a general project, it doesn't let me go further because it claims:
/path/to/my/folder overlaps the location of another project: 'gnu_magic'
This is indeed the name of the project I'm trying to import, but as I just imported it for the first time that shouldn't be a problem.
If I use the new project wizard, it doesn't let me use the same folder name as the project, claiming that the folder is not empty (which is true, but strange when I'm using the wizard to create an entirely new project). If I give the folder another name, it creates a project but the project isn't connected to the repository - I have no way of committing my changes back to Github.
Deleting the gnu_magic folder and starting all over again brings the same results.
Is there a way to remove the metadata over that specific project from Eclipse's configuration? I don't want to lose my other projects but I would like to work with Egit on that project.
Another interesting fact: If I clone the repository manually and then try to import it into Eclipse, as a project from my file system, it doesn't let me becasue the source is in the heirarchy of the destination.
Or am I missing the point here completely? I'm just surprised that I was able to clone the other repositories without any problems. Working with them over the past few days has been quite easy.
The solution was a bit strange. Here's the steps to solve it:
Clone repository using EGit
Eclipse refuses to import project, claiming it already exists. Exit import dialog.
Create new project using existing code, using cloned repository
Share project with old repository
Now the project is once again connected to the repository. Be careful with this method because if something goes wrong you might commit over your old code. This solution works with Indigo and Juno.
I'm using Eclipse 4.2 Indigo, and I've been struggling with these same problems for a while now.
If you have already cloned a repository on your machine somewhere, using EGit or whatever, you can:
1) Create a new Eclipse project.
2) File -> Import -> General -> File System Choose the cloned repository location. This will import everything, including the .git folder within the repository, into your Eclipse project in your workspace. For this it doesn't matter whether there's .project files anywhere in the imported files or not.
3) Team -> Share Project -> Git The EGit plugin should detect the .git folder within your project and suggest settings accordingly. You will have a new local repository location addded to EGit's repositories which will point to the .git folder under your project's directory.

Import an existing Git project into Eclipse without a .project file

I've forked and cloned a project to the local machine from GitHub using the terminal and am trying to import it into Eclipse.
The problem is the clone from GitHub doesn't have a .project file, so when I go import -> projects from Git, I can only import as a general project. How can I import the project to Eclipse without doing git init? Most of the solutions I saw have .project already there when they cloned it from Git.
Create a new java project, Untick "Use default location" and browse the git project path by clicking browse button. It works for me. I have just imported a Git, netbeans project into Eclipse through this simple method.
After a while I got it working as expected...
Basically the wizard is broken. This is what worked for me (eclipse 4.2.2):
You may use the wizard to import the git repository to your workspace.
After that you need to close the wizard and open the git Repositories view. (Window->Show View->Others->Git->Git repositories)
Right click on the repo you've just imported and select "Import Projects..."
I've imported a general project (it was SQL code only) and this time it worked as expected (The screen doesn't allow you to change the project name nor directory, which makes sense at this point.)
Those are the same steps performed by the wizard, but apparently it doesn't get the information about the project being already deployed at the workspace, so you get the option to change those values and it complains about the project already existing there.
You should create a new project in Eclipse and specify that the project be located in the existing directory.
Choose "Create project from existing source" in the wizard:
I use eclipse 3.7 ( indigo ) and I find this great solution:
1) click on: Navigate -> Show In -> Project Explorer
2) from Filesystem folder, find and select the folder where the project is contained
3) right chick on folder, and select Promote to Project
Do this:
File > Import > General > Existing Projects Into Workspace
then:
select root directory: select the path in you pc where the project is
if you want to to copy the existing project in a new project into your workspace, check the field copy projects into workspace, otherwise don't check it and continue to work directly into the existing project

Importing a Maven project into Eclipse from Git

How can I get the effect of choosing to import from both Maven and Git and have Eclipse properly generate my project?
To get my project into Eclipse I can choose File->import->maven and then I get all the Maven projects imported and can build fine, or I can choose File->import->git and make a new project that ignores the pom.xml and does not generate the project properly.
It seems I can do one or the other but not combine both so I get a correctly generated project.
Eclipse Indigo + M2Eclipse 1.0 makes it very easy.
If you don't already have the Git connector for M2Eclipse install it. M2Eclipse will help you along by prompting you on the Import menu.
Select the "Import..." context menu from the Package Explorer view
Select "Check out Maven projects from SCM" option under the Maven category
On the window that is presented choose the link "Find more SCM connectors in the m2e Marketplace
Find connector for Git...install...restart
Note that in the search box you may have to enter "EGit" instead of "Git" to find the right connector.
With that done, simply go to the EGit repository, bring up the context menu for the Working directory and select "Import Maven projects...".
Done!
I would perform a git clone via the command line (outside Eclipse) then use File -> Import... -> Existing Maven Projects.
Your projects will be understood as using Git and Maven. It's the fastest and most reliable way to import IMO.
Step 1 : Setting Up Eclipse
First of all you'll need to have a few Eclipse plug-ins installed. So use eclipse IDE software install feature in the help dropdown menu → Install new software, and add link to Available Software Site, then install it.
GIT plugin (EGIT)- http://download.eclipse.org/egit/updates
Eclipse Maven plugin (M2Eclipse) - http://download.eclipse.org/technology/m2e/releases
Maven SCM Handler for EGit (m2e-egit)
Install from the M2E Marketplace (Settings → Maven → Discovery → Open Catalog and search for " m2e-egit")
Step 2 : Clone the repository
Clone(download) your Maven Projects from Git
Check out non-eclipse Maven Projects from Git (File → Import.. → Maven → Check out Maven Projects from SCM)
Now add your git repository link to SCM URI field.Then click next & finish.
As of this (updated) writing, a working setup is the following:
Eclipse 3.8 (Eclipse Indigo update site)
EGit 1.3.0 (Eclipse Indigo update site)
m2e 1.0.200 (Eclipse Indigo update site)
m2e-egit 0.14.0 (m2e marketplace when adding a connector)
Tested on Ubuntu Raring.
You can certainly "Import" -> "Maven" -> "Check out Maven Projects from SCM", and this is the quickest way. However, such direct import currently does not give you control over the cloned repository folder name. You may be better off working from the "Git Repository" View and perform either a "Clone from a Git Repository and add the clone to this view", followed by an "Import Maven Projects" from such clone; the longest way would be to do your manual cloning and then "Add an existing local Git Repository to this view", followed again by an "Import Maven Projects". Either case you have full control on the cloned folder.
A final comment on a side issue that made me cry in frustration. As far as I know, if the cloned repository lies on the root of your Eclipse workspace, and your Maven project file hierarchy has a POM on its root, then importing such root project will rename the cloned folder (with the template you chose, defaults to [artifactId]). Without changing your project structure and without keeping files outside your workspace, you can easily work around this issue by cloning on a subsubfolder of the workspace folder.
I have been testing this out for my project.
Eclispe Indigo
"Help > Install New Software" Enable/Install official Git plug-ins at "Eclipse Git Plugin .." and install the lot.
Enable the Maven/EGit connector with these instructions How do you get git integration working with m2eclipse?
Switch to the Git Repository perspective. Right click paste the project git url. The defaults should all work. You may want to change the install folder it guesses.
Expand the cloned repository and right click on "Working Tree" and pick "Import Maven Projects...".
Switch to the Java perspective. Right click on the project and choose "Team > Share Project". Select "Git" and be sure to tick the box "Use or create repository in parent folder of project".
Here's my workaround, this is a solution to these issues:
You can't install m2e-egit (I get an error in Juno)
Converting a general project (connected to your Git repository) to a Maven project isn't working for you (The Import Maven Projects step seems essential)
Importing Maven Projects from your repository on the filesystem isn't showing the project connected to Git.
Setup your Git repository in the Git Repository Exploring perspective.
Switch to the Java perspective, Import > Existing Maven Projects
Browse to your Git checkout in the filesystem, select the directory containing the pom.xml file. Finish the import;
you'll notice these projects aren't connected to Git. :-(
Delete these projects, but DO NOT DELETE FROM FILESYSTEM.
We don't want our clone deleted; this task also leaves the .project file behind so that we can import in the next step.
Go back to the Git Repository Exploring perspective.
Right-click your repository, Import Projects...
Select Import existing projects
In the explorer below, browse to and select the directory containing the pom.xml (and .project file) , then click next.
Continue through the wizard.
Import without installing any additional connectors for Mylyn:
Open Git Repositories view (Window->Show view->Git Repositories)
Press Clone a Git Repository button and proceed with all steps
In newly created repository expand Working Directory, right click on folder with your project and select Import Projects. Then either choose Import existing projects, or select Import as general project. If needed after importing right click on your project and select Configure->Convert to Maven Project (and Maven->Update Project).
You should note that putting generated metadata under version control (let it be git or any other scm), is not a very good idea if there are more than one developer working on the codebase. Two developers may have a totally different project or classpath setup. Just as a heads up in case you intends to share the code at some time...
I have a maven project with three submodules that is managed in git. I set them up in eclipse as follows:
I registered the git repository with eclipse using EGit
I imported the projects as existing Maven Projects
For each project, I went Team | Share Project.
Direct answer: Go to Files>>Import>>Git>>Project From Git (you should have GIT installed on Eclips)
I would prefer to import projects into Eclipse as maven projects rather than git project. Doing this will still allow the project contents to be recognized as git contents. You can continue to perform git operations from Eclipse. As you have mentioned the reverse is not true.
The nature of a project in Eclipse is not based on the SCM which holds the project, but on the type of project - whether war or jar, etc. - which is automagically determined when the project is imported as maven project.
I would be hesitant to check-in to SCM IDE-specific metadata. Doing so assumes a lot of things - all developers are using the same IDE or version of the IDE, perhaps same version of JDK/JRE, that they continue to use the same version throughout the project lifecycle and so on.
Can't you import it as a git project and then (if you have the m2eclipse installed) right click on the project in the Package Explorer > Maven > Enable Dependency Management?
After checking out my branch in Egit, I switched to the Java View, then used File-->Import, Git-->Projects from Git, then selected the top level maven directory. This was with Eclipse Kepler.
Instead of constantly generating project metadata via import->maven command, you can generate your project metadata once and the place it in your git repository along with the rest of your source code. After than, using import->git command will import a proper maven-enabled project, assuming you have maven tools installed.
Make sure to place into the source control system all files in project dir that start with '.' such as .classpath and .project along with the entire contents of the .settings directory.

How to import an already checked out svn repository into Eclipse?

I have a Subversion repository I have checked out and have in my local hard disk. Now, how do I import this into Eclipse?
When I choose File > Import and choose SVN, there is only an option to checkout a project from the server again. File > New project seems to be for projects we are creating new projects from scratch.
"Import..." the existing project then "Share..." the project. The Subversive (or SubClipse) client will realize that the project has a .svn folder and reattach to the repository.
In Eclipse click on:
File -> Import -> General -> Existing Projects into Workspace
However you have to define a workspace location being different from the one that is being checked out in order to prevent yourself from changes to the checked out repository.
I've tried with File->Import Projects from File System or Archive, and in the blank space of Import source, you just need to browse through button Directory.. and find the project path you wanted to import. Then the svn connection is automatically detected.
Install the subversive plugin from market place or from update site.
Use appropriate SVN connectors during setup Windows->Preferances->Team->SVN->SVNConnectors. SVNKit 1.8.11 worked for me.
Make sure Enable automatic project share checkbox is set at this location Windows->Preferances->Team->SVN->General
Just import the existing SVN project File->Import->General->Existing Projects into Workspace, then eclipse will automatically recognize it based on the .svn hidden folder. Need not explicitly do Team->Share project.