Mercurial & Maven

Mercurial

Install Mercurial Mercurial and ssh
  • To file, you have to add two line:

[ui]

ssh = PATH_TO_PLINK/plink.exe -i PATH_TO_PRIVATE_KEY/PRIVATE_KEY.ppk

  • If [ui] exist in file, then you do not add this
  • PATH_TO_PLINK - replace by real path to plink
  • PATH_TO_PRIVATE_KEY - replace by real path to private key
  • If you use pageant.exe, then remove -i and private key
  • If your path contains some whitespace, then you have to put path between quotation marks (e.g. "PATH TO PLINK/plink.exe").
  • First connection of the plink.exe requires pressing 'y' to agree that the server certificate is ok. Unfortunately, this request is not shown and thus before cloning a repository it is needed to run:

PATH_TO_PLINK/plink.exe -i PATH_TO_PRIVATE_KEY # and answer 'y'.

Install Mercurial plugin in Eclipse

(http://www.javaforge.com/project/HGE )

  • Go to Eclipse
  • Eclipse Update Manager, just click Help → Software Updates in Eclipse. The Eclipse Update Site for MercurialEclipse is available at this URL: http://cbes.javaforge.com/update
  • There, you select just Eclipse Plugin (no binary for Windows)
Eclipse
  • Go to Window -> Preferences -> Team -> Mercurial
  • Now you have to set field "Mercurial Executable". Through file browser finds binary hg.exe, which is placed in directory, where was installed Mercurial. (hg.exe is Mercurial)
Clone project in Eclipse
  • File -> New -> Other -> Clone Existing Mercurial Repository
  • Set URL and Clone directory name

Notes for ssh:
Two slashes are behind smith.felk.cvut.cz. The second slash is represents root on file system, which is followed by path to repository.
ssh:////data/hg/agentpolis

Mercurial FAQ

Q: "plink.exe <USERNAME>@smith.felk.cvut.cz" says: FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey)
A: plink has to be used either with pageant.exe or with -i <path_to_private_key> parameter

Maven

Install Maven
Just follow download and installation instruction on official website .

Maven in NetBeans
NB has native support for maven, only use the project pom.xml.

Install Maven plugin for Eclipse

  1. For using maven with eclipse, you need to install maven plugin.
  2. In Eclipse Help -> Install New Software. There you can put update site http://download.eclipse.org/technology/m2e/milestones/1.0
  3. Then you select Maven Integration for Eclipse and you can finish install.

Set up Maven
After installation process, you should set up in maven "settings.xml" file connection to our maven repositories to can get dependencies for project. The file "settings.xml" is placed in ".m2" directory.

For Windows - C:\Users\USER_NAME\.m2

For Linux - /home/USER_NAME/.m2

  • If directory .m2 does not exist at you home directory, then you have to create new directory with name .m2

You need to download file settings.xml. For non-ATG members download settings for read-only version m for ATG members download internal version (need redmine login).

  • If file does not exist, then you can put there this file settings.xml.
  • If file exists, but is empty - <setting> element does not include some sub-element, then replace settings.xml file by this file settings.xml.
  • If file exist and <setting> element contains some sub-elements, then copy content of <setting> element from this file settings.xml.
Maven in Eclipse
  • If you cloned project and cloned project is not Maven project (in Eclipse has small M by Package Explorer), then right-click on project and select Configure (in pop-menu). In Configure select Convert to Maven (or you can try in pop-menu to select Maven->Enable Managment Dependencies)
  • After conversion, you make right-click on project and select Maven -> Update Dependencies

Notes for Maven
Updating of maven indexes can take a while (especially the main repo nexus-maven-repository-index.gz: ~10mins).

Browse repository
You can browse repository using ATG internal read-only login (need redmine login).

Create new Maven ATG project
  1. in console run command mvn archetype:generate -DarchetypeGroupId=cz.agents -DarchetypeArtifactId=atg-archetype -DarchetypeVersion=1.0-SNAPSHOT
  2. create Maven directories structure manually and add attached pom.xml

pom.xml Magnifier - Default pom.xml for new ATG projects. (512 Bytes) Hrstka Ondřej, 08/12/2011 01:07 PM