You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Si...@itsindia.com on 2001/08/29 07:33:43 UTC

Fileset initialization problem

I need few filesets to be referenced at a later point. The following is the
skeleton of my build.xml file.

<project name="...." default="init">

<target name="init">
<property name="src.dir" value="d:\src"/>
</target>

<fileset dir="${src.dir} id="fileset.1">
     <include name="**/.class"/>
</fileset>

<target name="create.ejbjar" depends="init">
     <ejbjar ...>
          .
          <support refid="fileset.1"/>
          .
          .
     </ejbjar>
</target>
</project>

When I execute, the build file fails saying that directory ${src.dir} does
not exist. It looks like ant is doing some fileset initiliazation before it
calls the default target. It works perfectly, if I hardcode the fileset
dir, instead of giving a property reference. Is there a workaround for this
problem?

 I am writing a generic ejbjar target which can be passed the required
paramters (descriptordir, support files etc), so that I can use to create
any EJB I need. Since the support element of ejbjar task needs a fileset, I
need a way of passing a fileset to the generic EJB target. Is there any
other way of doing this without passing filesets.

Thanks,
Siva Prasad


RE: Fileset initialization problem

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
replace

<target name="init">
 <property name="src.dir" value="d:\src"/>
</target>

with just

<property name="src.dir" value="d:\src"/>

BTW, everything outside a target is evaluated before any targets.

Conor


> -----Original Message-----
> From: Sivaprasad.Kancherla@itsindia.com
> [mailto:Sivaprasad.Kancherla@itsindia.com]
> Sent: Wednesday, 29 August 2001 3:34 PM
> To: ant-user@jakarta.apache.org
> Subject: Fileset initialization problem
>
>
> I need few filesets to be referenced at a later point. The
> following is the
> skeleton of my build.xml file.
>
> <project name="...." default="init">
>
> <target name="init">
> <property name="src.dir" value="d:\src"/>
> </target>
>
> <fileset dir="${src.dir} id="fileset.1">
>      <include name="**/.class"/>
> </fileset>
>
> <target name="create.ejbjar" depends="init">
>      <ejbjar ...>
>           .
>           <support refid="fileset.1"/>
>           .
>           .
>      </ejbjar>
> </target>
> </project>
>
> When I execute, the build file fails saying that directory ${src.dir} does
> not exist. It looks like ant is doing some fileset initiliazation
> before it
> calls the default target. It works perfectly, if I hardcode the fileset
> dir, instead of giving a property reference. Is there a
> workaround for this
> problem?
>
>  I am writing a generic ejbjar target which can be passed the required
> paramters (descriptordir, support files etc), so that I can use to create
> any EJB I need. Since the support element of ejbjar task needs a
> fileset, I
> need a way of passing a fileset to the generic EJB target. Is there any
> other way of doing this without passing filesets.
>
> Thanks,
> Siva Prasad
>
>