反应堆根的Maven变量 [英] Maven variable for reactor root
问题描述
在多模块Maven项目中,是否有一个变量指向根项目文件夹?
In a multi-module maven project, is there a variable that points to the root project folder?
-
${project.basedir}
指向当前项目的目录, -
${project.parent.basedir}
指向父项目的目录
${project.basedir}
points to the current project's directory,${project.parent.basedir}
points to the parent project's directory,
但是有一个变量始终指向根目录(执行maven命令的目录),而不管反应堆中的哪个项目?
but is there a variable that always points to the root directory (the one from which the maven command was executed), no matter from which project inside the reactor?
我意识到我想解决的问题几乎是无法解决的.我想要一个指向project.basedir,project.parent.basedir,project.parent.parent.basedir等的变量,以较高者为准.但是由于项目的父pom不必是文件系统中的父pom,所以我的整个方法都无济于事.所以我接受Pascal的回答,因为它回答了我的问题(即使我的问题不能解决我的问题).
I realized that the problem I wanted to solve is pretty much unsolvable. I wanted a variable that pointed to either project.basedir, project.parent.basedir, project.parent.parent.basedir etc, whichever is higher. But since a project's parent pom need not be it's parent in the file system, my whole approach won't help. So I am accepting Pascal's answer because it answers my question (even if my question does not solve my problem).
推荐答案
是否存在一个始终指向根目录(执行maven命令的目录)的变量
is there a variable that always points to the root directory (the one from which the maven command was executed)
user.dir
(工作目录)应该是该目录.
user.dir
(the working directory) should be that directory.
这篇关于反应堆根的Maven变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!