Re: Ant and jar creation

Dominique Devienne <[email protected]>
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <CAFCRh-9bz2c7crT7G0rO3Y6Mkt0zOhnXZd6FMTMKt8rKOdO5CQ@mail.gmail.com>
On Thu, Nov 9, 2017 at 2:30 PM, RAPPAZ Francois <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.