[ANT]物业及Classpathref继承&QUOT破裂;的foreach" [英] [ANT]Property and Classpathref inherit broken in "foreach"

查看:131
本文介绍了[ANT]物业及Classpathref继承&QUOT破裂;的foreach"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要简单介绍一下吧,这里有一个例子:

To explain it briefly, here is an example:

在build.xml文件,本地db.xml是进口的。而在本地db.xml,有一个名为热身的目标这就要求第三个文件的一个目标 - 本地gr.xml使用任务

In build.xml, local-db.xml is imported. And in local-db.xml, there is a target named "warmup" which calls one target of the third file -- local-gr.xml using task.

所有的公共属性和CLASSPATH DEFS都是进口的,并在build.xml文件设置。

All the common properties and classpath defs are imported and set in build.xml.

在project.properties:

in project.properties:

dest-dir=./destination

在build.xml文件:

in build.xml:

<path id="gr-classpath"> ... </path>
<import file="local-db.xml" />

在当地db.xml:

<ant antfile="local-gr.xml" target="deploy" inheritAll="true" inheritRefs="true" />

在本地gr.xml,有这样两个目标:

In local-gr.xml, there are two targets like this:

<target name="deploy">
    <tar ....../>
    <foreach list="${list1}" delimiter="," parallel="true" trim="true" param="item" target="deploy-single" />
</target>

<target name="deploy-single">
    something using property ${dest-dir} and path "gr-classpath"
</target>

现在这里的问题是:

属性$ {DEST-DIR}和路径GR-类路径可在部署,因为我设置inheritAll和inheritRefs可以使用,但它不能在部署单直接使用。 继承不会当目标被称为的foreach?

The property ${dest-dir} and path "gr-classpath" can be used in "deploy" because I set inheritAll and inheritRefs, but it can't be used directly in "deploy-single". "inherit" doesn't when the target is called by foreach?

我设法通过$ {DEST-DIR}为部署单用的帮助,但我没有找到任何方式来传递classpathrefGR-类路径,以部署单。

I managed to pass ${dest-dir} to "deploy-single" with the help of the , but I didn't find any way to pass the classpathref "gr-classpath" to "deploy-single".

我做了什么来解决它在部署单再次声明了,但我不喜欢它。

What I did to work around it was to claim the again in "deploy-single", but I don't like it at all.

为什么出现这种情况?我能做些什么,使之更优雅?

Why this happens? What can I do to make it more elegant?

推荐答案

借助蚂蚁-contrib 的foreach 任务默认情况下不传播所有属性和引用它的目标。但它确实有 inheritall inheritrefs 属性,您可以使用来实现这一目标。

The ant-contrib foreach task doesn't by default propagate all properties and references to it's target. But it does have inheritall and inheritrefs attributes that you can use to make that happen.

<foreach list="${list1}" delimiter="," parallel="true" trim="true"
         param="item" target="deploy-single"
         inheritall="true" inheritrefs="true"
/>

这篇关于[ANT]物业及Classpathref继承&QUOT破裂;的foreach&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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