我想使用maven-dependency-plugin将EAR文件从多模块项目的子模块复制到整个项目的根目录中。
to-deploy/
my-project/
ear-module-a/
ear-module-b/
more-modules-1/
ear-module-c/
ear-module-d/
more-modules-2/
ear-module-e/
ear-module-f/
...
希望所有EAR-files都从它们各自的模块的目标目录复制到my-project/../to-deploy,所以,我最终得到,to-deploy/
ear-module-a.ear
ear-module-b.ear
ear-module-c.ear
ear-module-d.ear
ear-module-e.ear
ear-module-f.ear
my-project/
...
我可以通过每个ear模块中的相对路径完成,如下所示:
org.apache.maven.plugins
maven-dependency-plugin
copy
install
copy
${project.groupId}
${project.artifactId}
${project.version}
ear
../../to-deploy
但是我不希望在元素中指定相对路径,我更喜欢这样的东西${reactor.root.directory}/../to-deploy但是我找不到这样的方法。
另外,我更喜欢继承这个maven-dependency-plugin配置,不需要为每个EAR-module指定它。
我还尝试从root pom继承一个自定义属性:
${basedir}
但是当我尝试在ear模块中使用${myproject.root}时,${basedir}将解析为ear模块的basedir。
有没有一个简单的方法来找到一个多模块项目的root?