You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Phillips, Matthew" <Ma...@dsto.defence.gov.au> on 2001/07/27 10:06:39 UTC

JarX: a task to generate JAR's using class dependencies

Hello all,

my group has been using Ant to manage our projects for some time and we now
depend on it, so a big thankyou to all the Ant developers.

In the spirit of giving something back, I'd like to offer to the Ant project
a task I've developed called JarX, which generates JAR's by tracing class
dependencies.  It essentially takes a main class (or, more generally, a set
of included classes) and follows the class dependency graph to create a
compact JAR containing only the required classes.  This is most useful when
creating a self-contained executable JAR that uses bits and pieces from a
number of 3rd party libraries.

If this is deemed to be a useful addition, please let me know how I should
go about submitting it.

Cheers,

Matthew.
--
matthew.phillips@dsto.defence.gov.au
 
Senior Software Engineer,
EVIS Group, Information Technology Division,
Defence Science and Technology Organisation.
Salisbury, South Australia


Re: JarX: a task to generate JAR's using class dependencies

Posted by Peter Donald <do...@apache.org>.
On Fri, 27 Jul 2001 18:06, Phillips, Matthew wrote:
> Hello all,
>
> my group has been using Ant to manage our projects for some time and we now
> depend on it, so a big thankyou to all the Ant developers.
>
> In the spirit of giving something back, I'd like to offer to the Ant
> project a task I've developed called JarX, which generates JAR's by tracing
> class dependencies.  It essentially takes a main class (or, more generally,
> a set of included classes) and follows the class dependency graph to create
> a compact JAR containing only the required classes.  This is most useful
> when creating a self-contained executable JAR that uses bits and pieces
> from a number of 3rd party libraries.
>
> If this is deemed to be a useful addition, please let me know how I should
> go about submitting it.

It would definetly be useful. The best way to contribute is to just send it 
along with a doc page describing the task. If you need to modify any other 
tasks you need to follow the directions on the following page under patches.
 
http://jakarta.apache.org/site/source.html

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               |
*-----------------------------------------------------*

[PATCH] EjbJar using code from depend task

Posted by Holger Engels <he...@mercatis.de>.
On Fri, 27 Jul 2001, Conor MacNeill wrote:

> This is something that is on my todo list so it would be good if you run
> with it. I would, however, like to see it integrated with the current <jar>
> task and also the code from the <depend> task. No sense in duplicating that
> sort of stuff. If your code is better, of course, we can change <depend> to
> use it instead. What I would really like to see is a jar service and
> possibly a dependency service that these tasks layer on top of. That way, I
> can re-jig ejbjar to use the jar service and automatically have the
> dependency gathering facility. I really want this to have the capability to
> automatically ad support classes into an EJB jar.

The patch, I sent with my last message, obsoletes these two patches to
EjbJar:

   Luis Miguel Hernanz   08-Jun-01   exclude javax and java classes
   Holger Engels         03-Aug-01   Find more classes

Sorry, I forgot to start the subject with [PATCH] .. the subject was also
misleading, because it referred to JarX instead of EjbJar .. sorry for
that!


Holger Engels


Re: JarX: a task to generate JAR's using class dependencies

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

I'll look at this once I get 1.4 out the door. A quick thought is that this
could/should make the check for superclasses and superinterfaces somewhat
redundant too. That might simplify things considerably. Would you be
interested in looking at that. We probably want to approach this in small
steps anyway, so you may want to hold off.

Conor

----- Original Message -----
From: "Holger Engels" <he...@mercatis.de>
To: <an...@jakarta.apache.org>
Sent: Friday, August 10, 2001 4:32 PM
Subject: Re: JarX: a task to generate JAR's using class dependencies


> On Fri, 27 Jul 2001, Conor MacNeill wrote:
>
> > This is something that is on my todo list so it would be good if you
run
> > with it. I would, however, like to see it integrated with the current
<jar>
> > task and also the code from the <depend> task. No sense in duplicating
that
> > sort of stuff. If your code is better, of course, we can change
<depend> to
> > use it instead. What I would really like to see is a jar service and
> > possibly a dependency service that these tasks layer on top of. That
way, I
> > can re-jig ejbjar to use the jar service and automatically have the
> > dependency gathering facility. I really want this to have the
capability to
> > automatically ad support classes into an EJB jar.
>
> Ok, I've just added this capability to the GenericDeploymentTool. The
> implementation uses
> org.apache.tools.ant.taskdefs.optional.depend.ClassFile to determine the
> class dependencies. I had to add another method getClassDependencies to
> ClassFile, because getClassRefs actually misses some referenced classes.
>
>
> I've attached both modified Sources ..
>
>
> Holger Engels
>


Re: JarX: a task to generate JAR's using class dependencies

Posted by Holger Engels <he...@mercatis.de>.
On Fri, 27 Jul 2001, Conor MacNeill wrote:

> This is something that is on my todo list so it would be good if you run
> with it. I would, however, like to see it integrated with the current <jar>
> task and also the code from the <depend> task. No sense in duplicating that
> sort of stuff. If your code is better, of course, we can change <depend> to
> use it instead. What I would really like to see is a jar service and
> possibly a dependency service that these tasks layer on top of. That way, I
> can re-jig ejbjar to use the jar service and automatically have the
> dependency gathering facility. I really want this to have the capability to
> automatically ad support classes into an EJB jar.

Ok, I've just added this capability to the GenericDeploymentTool. The
implementation uses
org.apache.tools.ant.taskdefs.optional.depend.ClassFile to determine the
class dependencies. I had to add another method getClassDependencies to
ClassFile, because getClassRefs actually misses some referenced classes.


I've attached both modified Sources ..


Holger Engels

Re: JarX: a task to generate JAR's using class dependencies

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

This is something that is on my todo list so it would be good if you run
with it. I would, however, like to see it integrated with the current <jar>
task and also the code from the <depend> task. No sense in duplicating that
sort of stuff. If your code is better, of course, we can change <depend> to
use it instead. What I would really like to see is a jar service and
possibly a dependency service that these tasks layer on top of. That way, I
can re-jig ejbjar to use the jar service and automatically have the
dependency gathering facility. I really want this to have the capability to
automatically ad support classes into an EJB jar.

I was going to tackle some of this, this weekend. Let me know your
timeframe.

Conor


----- Original Message -----
From: "Phillips, Matthew" <Ma...@dsto.defence.gov.au>
To: <an...@jakarta.apache.org>
Sent: Friday, July 27, 2001 6:06 PM
Subject: JarX: a task to generate JAR's using class dependencies


> Hello all,
>
> my group has been using Ant to manage our projects for some time and we
now
> depend on it, so a big thankyou to all the Ant developers.
>
> In the spirit of giving something back, I'd like to offer to the Ant
project
> a task I've developed called JarX, which generates JAR's by tracing class
> dependencies.  It essentially takes a main class (or, more generally, a
set
> of included classes) and follows the class dependency graph to create a
> compact JAR containing only the required classes.  This is most useful
when
> creating a self-contained executable JAR that uses bits and pieces from a
> number of 3rd party libraries.
>
> If this is deemed to be a useful addition, please let me know how I
should
> go about submitting it.
>
> Cheers,
>
> Matthew.
> --
> matthew.phillips@dsto.defence.gov.au
>
> Senior Software Engineer,
> EVIS Group, Information Technology Division,
> Defence Science and Technology Organisation.
> Salisbury, South Australia
>
>


Re: JarX: a task to generate JAR's using class dependencies

Posted by gu...@stinky.com.
Neat. Are you done developing it? I've got something that does nearly
the same thing, but for downloading Applet class files.  I wrote it
years ago.  If you think it would be useful to see my code, let me
know.

I called it "slurp" -- arguably, a bit more descriptive than "x".

 - Alex

On Fri, Jul 27, 2001 at 05:36:39PM +0930, Phillips, Matthew wrote:
> Hello all,
> 
> my group has been using Ant to manage our projects for some time and we now
> depend on it, so a big thankyou to all the Ant developers.
> 
> In the spirit of giving something back, I'd like to offer to the Ant project
> a task I've developed called JarX, which generates JAR's by tracing class
> dependencies.  It essentially takes a main class (or, more generally, a set
> of included classes) and follows the class dependency graph to create a
> compact JAR containing only the required classes.  This is most useful when
> creating a self-contained executable JAR that uses bits and pieces from a
> number of 3rd party libraries.
> 
> If this is deemed to be a useful addition, please let me know how I should
> go about submitting it.
> 
> Cheers,
> 
> Matthew.
> --
> matthew.phillips@dsto.defence.gov.au
>  
> Senior Software Engineer,
> EVIS Group, Information Technology Division,
> Defence Science and Technology Organisation.
> Salisbury, South Australia

-- 
Alex Chaffee                       mailto:alex@jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/