在“验证"中执行 Ant模式 [英] Execute Ant in "Validation" mode

查看:22
本文介绍了在“验证"中执行 Ant模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在验证代码中执行 Apache Ant 构建工具?

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

例如处理 build.xml 文件并展开所有 ${} 变量等,但实际上并未构建目标 Java 项目?

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

我只需要完成所有替换的完整 xml 构建文件,以便我可以看到源文件和 jar 文件等的确切位置.

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.

所以像value="${aaa.bbb.cc}/Impl.jar"/>"这样的条目

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

扩展为value="AnApplication/lib/Impl.jar"/>"

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

推荐答案

使用一个 checktarget 来做一些回显而不是真实的东西,例如

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>

然后用 ant -f yourbuildfile checkproperties 调用你的构建脚本
调用您的 checktarget 而不是使用它的真实目标运行您的构建文件
只需确保您的 checkproperties 目标与您的实际工作目标具有相同的依赖关系图,
以获得与您的实际目标相同的属性值

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

这篇关于在“验证"中执行 Ant模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆