Ant and jar creation

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Ant and jar creation

RAPPAZ Francois
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 !

François

Reply | Threaded
Open this post in threaded view
|

Re: Ant and jar creation

Alexandre Priou
use jenkins and make a task

Envoyé de mon iPhone

> Le 9 nov. 2017 à 14:30, RAPPAZ Francois <[hidden email]> a écrit :
>
> 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 !
>
> François
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Ant and jar creation

Dominique Devienne-2
In reply to this post by RAPPAZ Francois
On Thu, Nov 9, 2017 at 2:30 PM, RAPPAZ Francois <[hidden email]>
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
Reply | Threaded
Open this post in threaded view
|

RE: Ant and jar creation

RAPPAZ Francois
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:[hidden email]]
Sent: 09 November 2017 16:11
To: Ant Users List <[hidden email]>
Subject: Re: Ant and jar creation

On Thu, Nov 9, 2017 at 2:30 PM, RAPPAZ Francois <[hidden email]>
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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]