Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Local Repository using environment variables

How can I set up the < localRepository > tag with an environment user var. I tried this path: %myRepo%/repo but it doesn't works (myRepo=C:/maven/repo). I can't use an absolute path for portability issues but I can setup %myRepo% to the correct place on each system in which the absolute path may vary but the /repo stays the same. Can someone help me? Thanks. Using windows. Maven 2.2.1.

like image 856
sam Avatar asked Nov 04 '22 14:11

sam


1 Answers

You can use ${env.HOME} to refer to the environment variable %HOME%, and similarly any other environment variable.

However, you may want to set the repository location on each machine by specifying it in settings.xml which is allows each user to enter their own settings. See http://maven.apache.org/settings.html for detail on this and setting environment variables in general (note some parts specific to Maven 3 as marked).

like image 125
Ben Strawson Avatar answered Nov 09 '22 14:11

Ben Strawson