ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "fmarchioni@libero.it"<fmarchi...@libero.it>
Subject Re: [beginner] how to build a jar file with ant?
Date Fri, 23 Feb 2001 08:44:47 GMT
Hi Cathal,
sorry the target at the end was just a cut&paste error.
I tried with your snippet too but still the jar file doesn't get 
generated....

 <project name="myproject" default="compile" basedir=".">
 
 <target name="compile">
    <javac srcdir="bean" destdir="classes"
     debug="on" optimize="off" deprecation="off" />
 </target>
 
 <target name="dist" depends="compile">
    <jar jarfile="app.jar" basedir="classes" />
 </target>
 
 </project>


Any idea?
Thanks again
Francesco

> I think your build.xml file is rather invalid. You cannot explicitly
> nest targets. What you probably want to try is something like:
> 
> <project name="myproject" default="compile" basedir=".">
> 
> <target name="compile">
>    <javac srcdir="bean" destdir="classes"
>       debug="on" optimize="off" deprecation="off" />
> </target>
> 
> <target name="dist" depends="compile">
>    <jar jarfile="app.jar" basedir="classes" />
> </target>
> 
> </project>
> 
> Use dependencies to execute several tasks in a row, nesting seems
> intuitive but it's *not* how ant works.
> 
> So the command "ant" or "ant compile" will compile your files, and the
> command "ant dist" will run the compile task and jar your classes
> 
> good luck
> 	Cathal.
> 
> 
> "fmarchioni@libero.it" wrote:
> > 
> > Hi all,
> > I'm trying to build a jar file but it seems that
> > ant ignores my request!
> > 
> > This is my directory structure
> >          build.xml
> > [bean]          [classes]
> > sources         compiled classes
> > 
> > I'd like to jar all files under the "classes" dir
> > 
> > -This is my very little build.xml file-
> > 
> > <project name="myproject" default="compile" basedir=".">
> > 
> > <target name="dist" >
> > 
> >   <target name="compile" >
> >     <javac srcdir="bean" destdir="classes"
> >      debug="on" optimize="off" deprecation="off"/>
> >   </target>
> > 
> > <jar jarfile="app.jar" basedir="classes" />
> > 
> > </target>
> > </project>
> > 
> > Why the jar file doesn't get built?
> > Thank you very much in advance
> > Francesco
> 


Mime
View raw message