How do I enable MercurialEclipse plugin for a project? - eclipse

I have a project using mercurial for version control, and I'm trying to set it up in Eclipse. I cloned the project from the command line and then opened the project in eclipse by importing it as a maven project.
This works except for that eclipse/MercurialEclipse doesn't seem to pick up that this is an merurial repo.
If I go to project properties, the Mercurial option shows only the message "This project doesn't use MercurialEclipse as a Team provider."
In the "Team Synchronizing" perspective, Synchronize... just gives me a "clone repository wizard" saying "There are no Mercurial resources to syncrhonize".
Does anyone know how to get MercurialEclipse to pick up the existing repository for the project.

Figured this out myself.
Right click the project and choose Team > Share project...
That gives a wizard for enabling mercurial integration for the project.

Related

How to add Git nature to my project?

I cloned master branch into the directory
\home\David\git\Example
and then I went into the eclipse and imported this project and when i did that it imported the project to the directory
\home\David\workspace\Example
Now the problem is when I right click on the project in eclipse and select properties, I don't see git nature for this..
The below screenshot is on my office laptop
I have Egit plugin installed and I would like to be able to commit and push from eclipse..
Because the git nature is missing for the project, I cannot do that.
How do I add Git nature for the project?
Answer for someone who imported a project, for example, as a maven project and not as a git repository:
Right now, the fastest way to add git nature to your eclipse project is to right click to your project > team > share project
you should see your repo listed. Just click ok.

Can't pull a Gradle project in Eclipse

I'm part of a team working on a game project and we just moved our project to using Gradle. I can pull, commit, merge and push normally with Git GUI in Windows Explorer, but other members of the team can also pull in Eclipse by right-clicking the Gradle-project folder in Project Explorer view, choosing Team-menu and then Pull. However, in my Eclipse the "Team" settings only give me options to "Apply Patch" and "Share Project.." the whole team has tried to find a solution for this to no avail so far.
Before the project was built on Gradle, I was also able to pull in Eclipse by using the aforementioned method. We're using Git repository.
Any suggestions on where to look for the cause of this malfunction?
Thank you.
I assume then you don't store the Eclipse project files/settings in your Git repository but create them locally using gradle eclipse.
Then after importing the project into Eclipse (be sure not to copy it to the workspace) you can use the Share project... option under Team in the context menu. Then choose Git. Eclipse EGit will automatically detect if your project resides in an existing repository (it should be listed on the next wizard page) and set up the corresponding association.
The term Share project maybe is a bit confusing, as you also do it for projects that already are under version control.

Eclipse - Maven and Mercurial

I have a remote Mercurial repository containing Maven projects. I would like to clone it into my Eclipse workspace for development.
I currently have Maven Integration for Eclipse installed through Eclipse Marketplace. I also have MercurialEclipse. But I can't checkout the code as Maven projects. When I checkout normally, only the parent project code is fully downloaded which makes sense because the Maven nature is not identified.
I have svn integrated fine, and I have the plugin "Maven SCM Handler for Subclipse" so I can easily checkout the projects from svn as Maven projects. Is there something like this for Mercurial?
Also I checked "File->New->Other->Maven->Checkout Maven Projects from SCM", and I see only svn in the dropdown.
Please let me know if the Maven-Mercurial integration in eclipse is possible.
Thanks for looking into this.
I do that every day at work and there is a small trick for it.
Try to do it in this order:
clone the project from command line
then in eclipse import the project as a maven project
then right click on the project and select team->share->mercurial
follow the dialog boxes and eventually you will get to the one asking you the url of the scm.
And that's it.
For multiple module project, you might have to repeat steps 3 and 4 for each of them.
For info i am using the version 1.2.0 of the maven plugin and for the mercurial one i use the one from the new website: https://bitbucket.org/mercurialeclipse/main/wiki/Home
and configured with an external mercurial client.
You can clone and configure a multiple module project using MercurialEclipse and Maven plugins from Eclipse IDE performing the following steps.
Clone the project in Eclipse IDE using MercurialEclipse.
Right click on the cloned project in the Project Explorer, select "Configure" and then "Convert to Maven Project".
Select File, Import and "Existing Maven Project" and click Next. You will get your cloned project and modules automatically selected on the next screen, so just need to click Finish button.
Finally, you will get your multi module project cloned and configured as maven project.
I use MercurialEclipse plugin and do Checkout in other way:
Clone repository
File -> New -> Project...
Select Mercurial -> Clone Existing Mercurial Repository Next >
Type URL, Auth data, and Clone directory name (optional) Finish
Prepare project for Eclipse
Generate Eclipse files: execute mvn eclipse:eclipse in command line
Refresh project (via context menu or F5)
Sometimes in the end you need to select the right encoding:
Open Project properties
Set Resource -> Text file encoding to Other

Eclipse and EGit

I have installed EGit plugin on my Eclipse Helios SR2 Installation. I also have a initialize a GIT repository in one of my projects. But unlike SVN EGIT doesn't show me visiual indications when I make changes to the source code. Why is this happening? Even after the GIT repository is initialized and a commit is made there are no visual indications at all.
PS: I have used the Terminal to initialize the repository, add files and make the initial commit.
If you used the terminal, then you have to tell Eclipse, that the project is a Git project and should be managed by EGit. You can do that by right-clicking on the project, then select Team -> Share Project, choose Git, and in the following dialog check the box "use or create repository in parent folder of project". Then in the column "Repository" it should show you a path like "../.git". Now finish and you should be done.

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.