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.
Maven Local Repository using environment variables
Asked Answered
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).
for cli use I just learned this trick.
doskey mvn=mvn -s C:\Users\myuser\.m2\settings-alt.xml $*
Add that to an environmet file, e.g. some builds reuqire a specific maven, java and python version and %PATH% set this doskey up in that file
© 2022 - 2024 — McMap. All rights reserved.