Ant inheriting Maven properties

喜你入骨 提交于 2019-12-23 17:51:23

问题


I am considering converting an Ant/Ivy project to Ant/Maven-Ant-Tasks. I do not want to use Maven by itself because I need more control over the build process.

Is there any way for the Ant build.xml file inherit properties set in the pom.xml file?

I have been creating a generic build.xml file that can be used across several projects and loads a project-specific project.properties file, but it would be nicer if I could put all of those properties in the pom.xml file.

Thanks.


回答1:


I use the XMLProperty ant task to parse and copy those properties

http://ant.apache.org/manual/Tasks/xmlproperty.html

<xmlproperty file="<your pom location>" keepRoot="false"/>
<property name="test"   value="${properties.test}"/>

Another option, if you use the maven Antrun plugin to run the build, the properties will be available to use in the build file

http://maven.apache.org/plugins/maven-antrun-plugin/usage.html



来源:https://stackoverflow.com/questions/3839508/ant-inheriting-maven-properties

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!