Jar task: --module-version and --main-class options

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

Jar task: --module-version and --main-class options

Bruce Alspaugh
Java 9 and later add several new options to the jar tool:

https://docs.oracle.com/en/java/javase/11/tools/jar.html

I would like to use the --module-version and --main-class options with
Ant's Jar task, but I could not find them in the manual:

https://ant.apache.org/manual/Tasks/jar.html

I can accomplish this using exec, but it would be simpler if I could use
those options with the jar task. Can those two options be added?

Regards,

Bruce

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

Reply | Threaded
Open this post in threaded view
|

Re: Jar task: --module-version and --main-class options

Stefan Bodewig
On 2018-10-01, Bruce Alspaugh wrote:

> Java 9 and later add several new options to the jar tool:

> https://docs.oracle.com/en/java/javase/11/tools/jar.html

> I would like to use the --module-version and --main-class options with
> Ant's Jar task, but I could not find them in the manual:

> https://ant.apache.org/manual/Tasks/jar.html

> I can accomplish this using exec, but it would be simpler if I could
> use those options with the jar task. Can those two options be added?

I think there already is a Bugzilla enhancement request for --main-class
but none for --module-version. Can you either please update the existing
ticket[1] or add a new one for the second part?

As for "can it be done?": of course, but it may be a bit more difficult
than you think. Ant does not use the JDK's jar tool at all but rather
builds the jar by itself (that's just a ZIP with some extra contents,
after all). So we'll need to figure out from the docs what those
switches actually do and mimic the outcome.

Stefan

[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=62772

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

Reply | Threaded
Open this post in threaded view
|

Re: Jar task: --module-version and --main-class options

Bruce Alspaugh
As requested, I've created a new issue. Is there some reason why Ant
does not use the JDK's jar tool?

Bruce

[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=62789

On 10/02/2018 12:20 AM, Stefan Bodewig wrote:

> On 2018-10-01, Bruce Alspaugh wrote:
>
>> Java 9 and later add several new options to the jar tool:
>
>> https://docs.oracle.com/en/java/javase/11/tools/jar.html
>
>> I would like to use the --module-version and --main-class options with
>> Ant's Jar task, but I could not find them in the manual:
>
>> https://ant.apache.org/manual/Tasks/jar.html
>
>> I can accomplish this using exec, but it would be simpler if I could
>> use those options with the jar task. Can those two options be added?
>
> I think there already is a Bugzilla enhancement request for --main-class
> but none for --module-version. Can you either please update the existing
> ticket[1] or add a new one for the second part?
>
> As for "can it be done?": of course, but it may be a bit more difficult
> than you think. Ant does not use the JDK's jar tool at all but rather
> builds the jar by itself (that's just a ZIP with some extra contents,
> after all). So we'll need to figure out from the docs what those
> switches actually do and mimic the outcome.
>
> Stefan
>
> [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=62772
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

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

Reply | Threaded
Open this post in threaded view
|

Re: Jar task: --module-version and --main-class options

Stefan Bodewig
On 2018-10-02, Bruce Alspaugh wrote:

> As requested, I've created a new issue.

Thank you.

> Is there some reason why Ant does not use the JDK's jar tool?

Most of them are historical. For many years the archives created by the
jar tool simply have not really been valid ZIP files - actually
java.util.zip is to blame and forced us to recreate our own zip library.

Ant's <jar> task really mostly is a manifest aware variant of <zip> and
some of the features the task offers (merging manifests while merging
archives) would be difficult to do with the jar command line tool.

And then there is the performance reason which has become less
significant over time. In the earlier years of Ant JVM startup time was
a real problem so you avoided creating new processes by all
means. <javac> runs the compiler inside of the same JVM that is
executing Ant by default for just this reason. IIRC the jar command line
tool didn't offer a stable Java interface you could call into back then
(i.e. Java 1.1 or 1.2).

As I said, most reasons are historical.

Stefan

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