I have a maven goal which will execute a groovy file. This groovy file uses a path which is like below
System.getProperty("user.home");
This root path is used to build the another path which points to a jar file inside the local repository.
Unfortunately, I don't have permissions in C drive and I am using D drive. So my repository is also in D drive.
Because of this my build failed. To pass my build I am passing a command line arguments to maven like below
mvn clean install -Duser.home=D:\users\krishna
I want to know if there is a pom variable/place-holder something like {m2RepoHome} so that I can use the same variable in my groovy file.
Thanks in advance
Maven local repository is located in your local system. It is created by the maven when you run any maven command. By default, maven local repository is %USER_HOME%/. m2 directory.
Maven local repository by default get created by Maven in %USER_HOME% directory. To override the default location, mention another path in Maven settings. xml file available at %M2_HOME%\conf directory.
Maven provides a convenient place-holder settings.X
where X is any element in settings.xml file.
I used ${settings.localRepository}
and it worked.
Properties section in https://maven.apache.org/settings.html explains how to use it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With