You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Suu Quan <sq...@wwc.com> on 2001/06/01 20:11:59 UTC

how to jar a package

Novice speaking

I'm trying to make a jar file out of a 'package' all under the subdirectory
utils.
This is my task (my current directory is the top project directory, and
utils is a child of it)

<target name="utils" >
    <javac srcdir="utils" includes="**/*.java" excludes="**/test/**"
        classpathref="classpath"/>
    <jar jarfile="${lib}/utils.jar"
         basedir="utils"
         includes="**/*.class"
    />
</target>

what I get is

ldap/NumberString.class
ldap/IntegerString.class
net/
net/TcpServer.class
Log.class
Int.class

        instead of

utils/ldap/NumberString.class
utils/ldap/IntegerString.class
utils/net/
utils/net/TcpServer.class
utils/Log.class
utils/Int.class

    How do I correct it, so that other can refer tothe jar file as

import utils.*;


Re: how to jar a package

Posted by Suu Quan <sq...@wwc.com>.
> <target name="utils" >
>     <javac srcdir="utils" includes="**/*.java" excludes="**/test/**"
>         classpathref="classpath"/>
>     <jar jarfile="${lib}/utils.jar"
>          basedir="utils"
>          includes="**/*.class"
>     />
> </target>
>
> what I get is
>
> ldap/NumberString.class
> ldap/IntegerString.class
> net/
> net/TcpServer.class
> Log.class
> Int.class
>
>         instead of
>
> utils/ldap/NumberString.class
> utils/ldap/IntegerString.class
> utils/net/
> utils/net/TcpServer.class
> utils/Log.class
> utils/Int.class

Thanks to your responses, I fixed the basedir and the includes, and get the
result desired

Thanks a million.


Re: how to jar a package

Posted by Peter Donald <do...@apache.org>.
At 11:11 AM 6/1/01 -0700, Suu Quan wrote:
>Novice speaking
>
>I'm trying to make a jar file out of a 'package' all under the subdirectory
>utils.
>This is my task (my current directory is the top project directory, and
>utils is a child of it)
>
><target name="utils" >
>    <javac srcdir="utils" includes="**/*.java" excludes="**/test/**"
>        classpathref="classpath"/>
>    <jar jarfile="${lib}/utils.jar"
>         basedir="utils"
>         includes="**/*.class"
>    />
></target>
>
>what I get is
>
>ldap/NumberString.class
>ldap/IntegerString.class
>net/
>net/TcpServer.class
>Log.class
>Int.class
>
>        instead of
>
>utils/ldap/NumberString.class
>utils/ldap/IntegerString.class
>utils/net/
>utils/net/TcpServer.class
>utils/Log.class
>utils/Int.class
>
>    How do I correct it, so that other can refer tothe jar file as
>
>import utils.*;

Use

    <jar jarfile="${lib}/utils.jar"
         basedir="."
         includes="utils/*.class"
    />

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Re: how to jar a package

Posted by Devon Hillard <de...@atg.com>.
If you only want to include the files within utils, use your include filter
to select only files under the utils directory.

Regards,

Devon


----- Original Message -----
From: "Aaron Haspel" <aa...@eredyne.com>
To: <an...@jakarta.apache.org>
Sent: Friday, June 01, 2001 2:17 PM
Subject: RE: how to jar a package


> Your basedir should be the parent directory of utils, not "utils" itself.
> If you try jarring from the command line you will see the same result.
>
> Aaron
>
> -----Original Message-----
> From: Suu Quan [mailto:squan@wwc.com]
> Sent: Friday, June 01, 2001 2:12 PM
> To: ANT user group
> Subject: how to jar a package
>
>
> Novice speaking
>
> I'm trying to make a jar file out of a 'package' all under the
subdirectory
> utils.
> This is my task (my current directory is the top project directory, and
> utils is a child of it)
>
> <target name="utils" >
>     <javac srcdir="utils" includes="**/*.java" excludes="**/test/**"
>         classpathref="classpath"/>
>     <jar jarfile="${lib}/utils.jar"
>          basedir="utils"
>          includes="**/*.class"
>     />
> </target>
>
> what I get is
>
> ldap/NumberString.class
> ldap/IntegerString.class
> net/
> net/TcpServer.class
> Log.class
> Int.class
>
>         instead of
>
> utils/ldap/NumberString.class
> utils/ldap/IntegerString.class
> utils/net/
> utils/net/TcpServer.class
> utils/Log.class
> utils/Int.class
>
>     How do I correct it, so that other can refer tothe jar file as
>
> import utils.*;
>
>


RE: how to jar a package

Posted by Aaron Haspel <aa...@eredyne.com>.
Your basedir should be the parent directory of utils, not "utils" itself.
If you try jarring from the command line you will see the same result.

Aaron

-----Original Message-----
From: Suu Quan [mailto:squan@wwc.com]
Sent: Friday, June 01, 2001 2:12 PM
To: ANT user group
Subject: how to jar a package


Novice speaking

I'm trying to make a jar file out of a 'package' all under the subdirectory
utils.
This is my task (my current directory is the top project directory, and
utils is a child of it)

<target name="utils" >
    <javac srcdir="utils" includes="**/*.java" excludes="**/test/**"
        classpathref="classpath"/>
    <jar jarfile="${lib}/utils.jar"
         basedir="utils"
         includes="**/*.class"
    />
</target>

what I get is

ldap/NumberString.class
ldap/IntegerString.class
net/
net/TcpServer.class
Log.class
Int.class

        instead of

utils/ldap/NumberString.class
utils/ldap/IntegerString.class
utils/net/
utils/net/TcpServer.class
utils/Log.class
utils/Int.class

    How do I correct it, so that other can refer tothe jar file as

import utils.*;