Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project setup with Eclipse and Mercurial

I would like some advice on setting up a multi-project workspace using Eclipse. In other words, I intend to create some application which will use two or more projects for its final build. The projects will be stored in some version control system. This is pretty easy to do.

The advice I am seeking is how I should set up the version control or Eclipse workspace to make setting up a new developer/new machine* very simple. Ideally, that new developer or developer on a new machine would simply issue one command (to something: it could be Eclipse, the version control system, some build system, or even a script); that command will set up an environment from which it would be possible to build the code.

I will use Java for a language and Mercurial for version control, if that matters for a solution. I am open to using a build system, although I have no almost no familiarity with any of them.

Essentially, I am to hoping to learn

  • where the projects should be stored in the repository
  • how Eclipse should import or otherwise discover the projects
  • how to initiate the discovery mentioned above

*In this case, a new machine means a machine with necessary applications (such as Eclipse and TortoiseHg) but without checkouts of the code or any workspaces

like image 587
Eric Avatar asked Feb 07 '11 16:02

Eric


People also ask

How to install Mercurial plugin in Eclipse?

The simplest way to install Mercurial is to go on the Eclipse Marketplace “Help → Eclipse Marketplace” and get the plugin. This way you will get only the plugin and not the Mercurial binaries.


1 Answers

Each Eclipse installation will need to install the MercurialEclipse plugin which can be installed through 'Install New Software...' by pointing it at the following URL: http://cbes.javaforge.com/update

Theses are the steps I usually use when setting up a new application:

  1. Setup my projects in Eclipse
  2. Go to the command line, create an hg repository and then move my projects into the folder that contains the repository.
  3. Delete the bin directories (so they don't get checked into Mercurial)
  4. Issue the 'hg add' at the root of your Mercurial repository.
  5. In Eclipse delete your projects (don't click the 'Delete project contents on disk' checkbox or you will get an error)
  6. In the File menu choose import. Select 'Existing Projects into Workspace' under the General folder.
  7. Select the 'Browse...' button next to 'Select root directory' and select your mercurial repository root folder.
  8. Click Select All in the import dialog and then click Finish.
  9. Open up the navigator view (so you can see bin folders), right click on the bin directory in one project, go to 'Team' and 'Ignore...'. Select 'Only this folder ('bin')' and click OK.
  10. Select all of the projects, right click, select 'Team' and choose 'Commit'

At this point your workspace is completely connected to a local Mercurial repository and all your folder structures are set up correctly.

When you are ready to share this with someone else you push your repository to a shared location. In another Eclipse environment (probably on another computer) Go to the 'Window' menu and select 'Show View' and 'Other...'. In the Mercurial folder select 'Mercurial Repositories' and click 'OK'. In the Mercurial Repositories view which just showed up click the 'Create Repository...' button. It looks like a team repository with the words HG and a plus sign. Put in your shared repository URL and any authentication information if needed. Right click on the repository just created and click 'Clone Repository'. That is it. All of the Eclipse setup is pulled from Mercurial and everything is set up for the second developer.

This may sound like a lot of steps but I am able to do this in less than two minutes now that I have practiced doing it a few times.

like image 107
rancidfishbreath Avatar answered Sep 28 '22 06:09

rancidfishbreath