我正在考虑将 Ant/Ivy 项目转换为 Ant/Maven-Ant-Tasks。我不想单独使用 Maven,因为我需要对构建过程进行更多控制。
有没有办法让Ant build.xml 文件继承pom.xml 文件中设置的属性?
我一直在创建一个通用的 build.xml 文件,该文件可以在多个项目中使用,并加载特定于项目的 project.properties 文件,但如果我可以将所有这些属性放入 pom.xml 文件中,那就更好了。
Thanks.
我使用 XMLProperty ant 任务来解析和复制这些属性
http://ant.apache.org/manual/Tasks/xmlproperty.html http://ant.apache.org/manual/Tasks/xmlproperty.html
<xmlproperty file="<your pom location>" keepRoot="false"/>
<property name="test" value="${properties.test}"/>
另一种选择,如果您使用 maven Antrun 插件来运行构建,则属性将可在构建文件中使用
http://maven.apache.org/plugins/maven-antrun-plugin/usage.html http://maven.apache.org/plugins/maven-antrun-plugin/usage.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)