Execute Ant in “Validation” mode

夙愿已清 提交于 2019-12-11 11:58:25

问题


Is it possible to execute Apache Ant build tool in a validation ode?

e.g to process a build.xml file and expand all the ${} variables etc but not actually build the target java projects?

i just need the completed xml build file with all the substitutions completed so that i can see the exact locations of source and jar files etc.

so that entries like "value="${aaa.bbb.cc}/Impl.jar"/>"

are expanded to "value="AnApplication/lib/Impl.jar"/>"


回答1:


use a checktarget that does some echoing instead of the real stuff, f.e.

<target name="checkproperties" depends="init,etc.../>
 <echoproperties prefix="aaa"/>
 <echo>
  ${aaa.bbb.cc}/Impl.jar
  ${dist.dir}
  ${src.dir}
  ${build.dir}
  ${whatever}
  ...
 </echo>
</target>

and then call your buildscript with ant -f yourbuildfile checkproperties
to call your checktarget instead of running your buildfile with it's real target
just make sure your checkproperties target has the same dependency graph as your real working target,
to get the same propertyvalues your real target would get



来源:https://stackoverflow.com/questions/6723845/execute-ant-in-validation-mode

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