Mercurial & Maven¶
- Download Mercurial from https://www.mercurial-scm.org/wiki/Download
- After download Mercurial, install Mercurial (note - select checkbox for adding Mercurial to environment path).
- I assume, that you have generated private key (for Win: puttygen.exe at http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html).
- Download plink.exe (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
- If you installed version, which does not require admin rights. Then you move to directory, where you installed Mercurial and find "mercurial.ini " file. If you install version with admin rights or you do not find "mercurial.ini " file, then you must create "mercurial.ini " file in your home directory (home directory is represented on Windows system by HOME variable - see cmd echo HOME)
- To file, you have to add two line:
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 firstname.lastname@example.org -i PATH_TO_PRIVATE_KEY # and answer 'y'.
Install Mercurial plugin in Eclipse
- 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)
- 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)
- 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.
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
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
- For using maven with eclipse, you need to install maven plugin.
- In Eclipse Help -> Install New Software. There you can put update site http://download.eclipse.org/technology/m2e/milestones/1.0
- 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
- 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.
- 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).
- in console run command mvn archetype:generate -DarchetypeGroupId=cz.agents -DarchetypeArtifactId=atg-archetype -DarchetypeVersion=1.0-SNAPSHOT
- create Maven directories structure manually and add attached pom.xml