简体   繁体   English

如何从子pom将自定义父pom属性导出到文件?

[英]How to export custom parent pom properties to a file, from a child pom?

I have a parent pom with some custom properties and I would like to export those properties from one of the child to a file. 我有一个带有一些自定义属性的父pom,我想将这些属性从子项之一导出到文件中。

I tried maven-antrun-plugin with echo, but this works only with the child properties. 我尝试将maven-antrun-plugin与echo一起使用,但这仅适用于子属性。 I also tried to define child properties and assign the parent properties (eg <child.prop>${parent.prop}</child.prop> ) but I got the same result. 我也尝试定义子属性并分配父属性(例如<child.prop>${parent.prop}</child.prop> ),但是得到的结果相同。

Update: It worked after I run mvn clean install on the parent. 更新:在父级上运行mvn clean install后,它起作用了。

仅当在父级上安装mvn后,父级自定义属性才在子pom中可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM