I found a solution to this problem.

The support element happens to be a fileset. Initially I was using it like
this:

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

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

Now I changed it to the following, obviating the need for fileset which was
causing the problem.

<patternset id="patternset.1">
     <include name="**/.class"/>
</fileset>

<target name="create.ejbjar" depends="init">
     <ejbjar ...>
          .
          <support dir="${src.dir}">
               <patternset refid="patternset.1"/>
          </support>
          .
     </ejbjar>
</target>

- Siva



                                                                                       
                                      
                    Sivaprasad.Kancherla@it                                            
                                      
                    sindia.com                     To:     [EMAIL PROTECTED] 
                                      
                                                   cc:                                 
                                      
                    08/29/01 11:34 AM              Subject:     RE: Fileset 
initialization problem                           
                    Please respond to                                                  
                                      
                    ant-user                                                           
                                      
                                                                                       
                                      
                                                                                       
                                      




> replace
>
> <target name="init">
>  <property name="src.dir" value="d:\src"/>
> </target>
It is actually ${build.dir}. Sorry about the confusion. I need to create
this directory in the init target. Now the problem is that the build fails
saying the directory does not exist. How do I create a directory before Ant
evaluates the fileset?
>
> with just
>
> <property name="src.dir" value="d:\src"/>


>
> BTW, everything outside a target is evaluated before any targets.
>
> Conor
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, 29 August 2001 3:34 PM
> > To: [EMAIL PROTECTED]
> > 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
> >
> >
>
>
>
>





Reply via email to