Monday, March 15, 2010

Install Maven with a Proxy


First install Maven. For example on Ubuntu 9.10 :

sudo apt-get install maven2


Then we will create the directory $HOME/.m2 :

mvn archetype:create -DgroupId=be.peopleware.training.maven -DartifactId=helloWorld
=> It will create .m2 automaticaly.

Note : Perhaps you can do by hand but I've not tested.You have certainly to check rights.
Note : It could be long and it will make an error but it will create the .m2 directory.


After that you had to create settings.xml in the .m2 directory like that :

vi settings.xml


        /home/drieu/.m2/repository
       
               
                        optional
                        true
                        http
                        proxy.test.fr
                        8080
                        localhost|127.0.0.1
               
 


To resume, you have a .m2 directory similar to that :
$HOME/.m2/settings.xml
$HOME/.m2/repository

Then go on your workspace directory (ex :$HOME/workspace) and launch the following command : mvn archetype:create -DgroupId=be.peopleware.training.maven -DartifactId=helloWorld