ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyril Sagan <cyril.sa...@gmail.com>
Subject Re: Conditional import?
Date Fri, 17 Sep 2010 01:52:45 GMT
The only way we've found to accomplish this is with <if/> from ant-contrib.
 Using your example:

<ac:if>
    <isset property="some_property_is_set" />
    <then>
        <import file="file1.xml" />
    </then>
</ac:if>

Hope this helps.

--Cyril

On Thu, Sep 16, 2010 at 12:03 AM, Stefan Bodewig <bodewig@apache.org> wrote:

> On 2010-09-15, John W. Lewis wrote:
>
> > Can imports go in targets?
>
> No.
>
> Ant needs to know all targets in order to build the dependency graph
> before it can start executing the first target.  This means all <import>
> must have been done before any target is run.
>
> > The way I have done it in the past is to conditionally set a property
> > and import the property.  When I don't want to import something, I set
> > the property to a filename that does not exist.  Make sure you
> > <import optional="true" />.
>
> Good idea.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message