什么是好的Ant目标命名约定?

Ric*_*chH 10 ant build-process build naming-conventions

我即将创建一些复杂的Ant构建文件,我想知道人们认为什么是命名ant任务的最佳实践.它将构建一些Java,C++,压缩JavaScript,生成文档等等.

您总是在任何脚本中添加哪些任务?像干净,构建的东西?

如何通过依赖关系命名构成单个目标的目标(或者不执行此操作)?例如build.proj1和build.proj2

你遵循任何其他命名约定?

Reb*_*bse 10

Another common practice is a kind of 'private' target. Simply put a leading '-' before the target name, i.e. <target name="-yourprivatetarget" ... />. Thus it's impossible to call that target via command line, as : ant -f yourbuild.xml -yourprivatetarget won't work whereas
<target name="yourprivatetarget" ... /> and ant -f yourbuild.xml yourprivatetarget would.

使用ant -projecthelp(或ant -p)时,也不会列出没有description属性的目标.所以你有一些私有/内部目标,但要注意,一些工具,即Eclipse或类似工具将在它的ant编辑器的Outline视图中公开所有目标.

最后=>蚂蚁中没有真正的私人/内部目标,但它有时会有所帮助


Jos*_*seK 7

此链接说明了项目中应具有的典型目标.

使用标准目标有助于新团队成员(以及任何经验丰富的Ant手)快速掌握构建过程.

根据个人经验,我会说clean, build, deploy/install, test(测试运行你的junits,findbugs等)

对于依赖目标,我们使用如下的约定

<target name="build" depends="clean,compile">

<target name="compile" depends="compile.src, compile.test">
Run Code Online (Sandbox Code Playgroud)