ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RAPPAZ Francois <francois.rap...@unifr.ch>
Subject RE: Ant and jar creation
Date Fri, 10 Nov 2017 08:10:32 GMT
Thanks for the hint

I saw that there is an ejbjar tasks that use the BCEL parser
https://ant.apache.org/manual/Tasks/ejb.html

could I use this to build "normal" jar file ?

BCEL seems to be what's is needed to have the job done in ant. 
There is a listclass.java example that list the dependencies starting from the class given
in argument. I could still take this to have a list that I could use with a normal jar ant
task....

Strange that BCEL is not use with the jar task in ant ...
Thanks
F.

-----Original Message-----
From: Dominique Devienne [mailto:ddevienne@gmail.com] 
Sent: 09 November 2017 16:11
To: Ant Users List <user@ant.apache.org>
Subject: Re: Ant and jar creation

On Thu, Nov 9, 2017 at 2:30 PM, RAPPAZ Francois <francois.rappaz@unifr.ch>
wrote:

> I'm returning to some java projects that I left for some years. These 
> projects use ant to compile, make  the doc and specially they use the 
> external task genjar to build jar files.
>
> I spend some hours trying to have genjar working (I downloaded the 
> source from sourceforge) and it's seems that the part of the code that 
> try to read the class file does not work anymore. It's seems I'm 
> hitting the end of the file when that was not expected.
>
> The most recent version of genjar is  1.0.2 and is more the ten years old.
>
> Does anyone know of a substitute ? I can use the jar task from ant, 
> once I have a list of classes, but to build elegantly a jar without a 
> list, genjar was great.
>
> Thanks for any suggestion !
>

Sounds like that very old GenJar custom task was never updated for newer JDKs and new .class
file formats?

The <depend> task almost does what you want I think, but doesn't expose a Selector unfortunately.
But it looks like it has the code to do what you want, with an external dependency to a .class
file parser probably though.
(even GenJar had plans to use BCEL for that, but that probably never materialized).

Once you have that depend-based selector, you can use <jar> almost like you did <genjar>
IMHO.

FWIW. Good luck, --DD

[1] https://ant.apache.org/manual/Tasks/depend.html
[2] https://ant.apache.org/manual/Types/selectors.html
[3]
http://ant.apache.org/manual/api/index.html?org/apache/tools/ant/util/depend/bcel/AncestorAnalyzer.html
Mime
View raw message