You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by burtonator <bu...@relativity.yi.org> on 2001/07/25 03:47:06 UTC

Automatically importing a directory of .jar files.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hey.

I want to make it easy for my projects to be downloaded and built without any
major CLASSPATH hacks.  I am putting all my .jar files into PROJECT/lib but I am
hving to manually add EACH .jar into the "classpath" attribute on the javac
task.

It would make sense to just do a

<import-classpath dir="../lib"/>

And then run javac like:

<javac classpath="${CLASSPATH}

The ImportClasspath taskdef would read all .jar files form the given directory
and add them to the classpath.

Doesn't this seem more "clean" than manually adding each classpath entry?  Has
anyone attempted a Taskdef like this?

Kevin

- -- 
Kevin A. Burton ( burton@apache.org, burton@openprivacy.org, burtonator@acm.org )
        Cell: 408-910-6145 URL: http://relativity.yi.org ICQ: 73488596 

Without enlightenment, there is only ignorance.
  -- famous Zen Koan



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt

iD8DBQE7XiUaAwM6xb2dfE0RApgHAJ9tkzO2BxXH/xB0q8lF/j5ZscJrDwCeMsV8
xOYiWLtQ5CYQD+9GN5XzBUI=
=UJCP
-----END PGP SIGNATURE-----


Re: Automatically importing a directory of .jar files.

Posted by Stefan Bodewig <bo...@apache.org>.
On 24 Jul 2001, <bu...@relativity.yi.org> wrote:

> I want to make it easy for my projects to be downloaded and built
> without any major CLASSPATH hacks.  I am putting all my .jar files
> into PROJECT/lib but I am hving to manually add EACH .jar into the
> "classpath" attribute on the javac task.

This should do it (possible since Ant 1.2):

<javac ...>
  <classpath>
    <fileset dir="PROJECT/lib">
      <include name="*.jar" />
    </fileset>
  </classpath>
</javac>

Stefan

Re: Automatically importing a directory of .jar files.

Posted by Peter Donald <do...@apache.org>.
Sounds like you want

<javac ...>
  <classpath>
    <fileset dir="lib">
      <include name="*.jar" />
    </fileset>
  </classpath>
</javac>

On Wed, 25 Jul 2001 11:47, burtonator wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Hey.
>
> I want to make it easy for my projects to be downloaded and built without
> any major CLASSPATH hacks.  I am putting all my .jar files into PROJECT/lib
> but I am hving to manually add EACH .jar into the "classpath" attribute on
> the javac task.
>
> It would make sense to just do a
>
> <import-classpath dir="../lib"/>
>
> And then run javac like:
>
> <javac classpath="${CLASSPATH}
>
> The ImportClasspath taskdef would read all .jar files form the given
> directory and add them to the classpath.
>
> Doesn't this seem more "clean" than manually adding each classpath entry? 
> Has anyone attempted a Taskdef like this?
>
> Kevin
>
> - --
> Kevin A. Burton ( burton@apache.org, burton@openprivacy.org,
> burtonator@acm.org ) Cell: 408-910-6145 URL: http://relativity.yi.org ICQ:
> 73488596
>
> Without enlightenment, there is only ignorance.
>   -- famous Zen Koan
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.4 (GNU/Linux)
> Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt
>
> iD8DBQE7XiUaAwM6xb2dfE0RApgHAJ9tkzO2BxXH/xB0q8lF/j5ZscJrDwCeMsV8
> xOYiWLtQ5CYQD+9GN5XzBUI=
> =UJCP
> -----END PGP SIGNATURE-----

-- 
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: Automatically importing a directory of .jar files.

Posted by Erik Hatcher <er...@earthlink.net>.
Here's how you can make your life easier.   At the top of your build.xml
(outside any targets), specify this:

<patternset id="patternset-lib">
    <include name="**/*.jar"/>
    <include name="**/*.zip"/>
</patternset>

Then, inside <javac>, use this:

<classpath>
    <fileset dir="${lib.dir}">
        <patternset refid="patternset-lib"/>
    </fileset>
</classpath>

With, of course, the lib.dir property set to your lib directory.

    Erik

----- Original Message -----
From: "burtonator" <bu...@relativity.yi.org>
To: <an...@jakarta.apache.org>
Sent: Tuesday, July 24, 2001 6:47 PM
Subject: Automatically importing a directory of .jar files.


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Hey.
>
> I want to make it easy for my projects to be downloaded and built without
any
> major CLASSPATH hacks.  I am putting all my .jar files into PROJECT/lib
but I am
> hving to manually add EACH .jar into the "classpath" attribute on the
javac
> task.
>
> It would make sense to just do a
>
> <import-classpath dir="../lib"/>
>
> And then run javac like:
>
> <javac classpath="${CLASSPATH}
>
> The ImportClasspath taskdef would read all .jar files form the given
directory
> and add them to the classpath.
>
> Doesn't this seem more "clean" than manually adding each classpath entry?
Has
> anyone attempted a Taskdef like this?
>
> Kevin
>
> - --
> Kevin A. Burton ( burton@apache.org, burton@openprivacy.org,
burtonator@acm.org )
>         Cell: 408-910-6145 URL: http://relativity.yi.org ICQ: 73488596
>
> Without enlightenment, there is only ignorance.
>   -- famous Zen Koan
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.4 (GNU/Linux)
> Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt
>
> iD8DBQE7XiUaAwM6xb2dfE0RApgHAJ9tkzO2BxXH/xB0q8lF/j5ZscJrDwCeMsV8
> xOYiWLtQ5CYQD+9GN5XzBUI=
> =UJCP
> -----END PGP SIGNATURE-----
>



Re: Automatically importing a directory of .jar files.

Posted by Cuong Tran <ct...@yahoo.com>.
 I usually do this:

    <javac srcdir="${src.main}"
           destdir="${build.classes}"
           debug="off"
           deprecation="off"
           optimize="on" 
           includes="**/*.java" >
      <classpath>
        <pathelement path="${java.class.path}" />
        <fileset dir="lib/">
          <include name="**/*.jar" />
        </fileset>
      </classpath>
    </javac>

--- burtonator <bu...@relativity.yi.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> Hey.
> 
> I want to make it easy for my projects to be downloaded and built without any
> major CLASSPATH hacks.  I am putting all my .jar files into PROJECT/lib but I
> am
> hving to manually add EACH .jar into the "classpath" attribute on the javac
> task.
> 
> It would make sense to just do a
> 
> <import-classpath dir="../lib"/>
> 
> And then run javac like:
> 
> <javac classpath="${CLASSPATH}
> 
> The ImportClasspath taskdef would read all .jar files form the given
> directory
> and add them to the classpath.
> 
> Doesn't this seem more "clean" than manually adding each classpath entry? 
> Has
> anyone attempted a Taskdef like this?
> 
> Kevin
> 
> - -- 
> Kevin A. Burton ( burton@apache.org, burton@openprivacy.org,
> burtonator@acm.org )
>         Cell: 408-910-6145 URL: http://relativity.yi.org ICQ: 73488596 
> 
> Without enlightenment, there is only ignorance.
>   -- famous Zen Koan
> 
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.4 (GNU/Linux)
> Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt
> 
> iD8DBQE7XiUaAwM6xb2dfE0RApgHAJ9tkzO2BxXH/xB0q8lF/j5ZscJrDwCeMsV8
> xOYiWLtQ5CYQD+9GN5XzBUI=
> =UJCP
> -----END PGP SIGNATURE-----
> 


=====
Cuong Q. Tran <ct...@yahoo.com>

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/