In a multi-module maven project, is there a variable that points to the root project folder?
${project.basedir}
points to the current project\'s d
For me, there was a need for root directory during variable interpolation, not for plugins section - for local directory relative to root with hand-crafted jars. I know this is a bad practice to have local directory with jars, but this was a requirement of project.
Why I was unable to use different solutions:
${session.executionRootDirectory}
and ${user.dir}
are tied with directory from which maven command was executed. I want to refer to the same directory independently of directory, from which maven was launched.${project.basedir}
,as mentioned above, points to current project directory, so child modules will search for jars in wrong location.So, in my case with bad requirements I have used environment variable which refers project root and used it in pom.xml. Use it as last resort, when other solutions do not work. Here is example, how I use environment variable in my case:
<repositories>
<repository>
<id>local-maven-repo</id>
<!--NOTE: export PROJECT_ROOT=<location>-->
<url>file:///${env.PROJECT_ROOT}/local-repo</url>
</repository>
</repositories>