ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Matèrne (jhm) <>
Subject AW: Multi-Release JARs
Date Sat, 17 Sep 2016 16:32:58 GMT
In the current "Java Spectrum" there is an article about some Java9 topics,
including the multi-release-jar.
They point to a Maven proof of concept. So we could (should) have a look
there, too.

> Things I see we could do (and I'm sure this list is not exhaustive):
> * provide a new kind of <zipfileset> that uses
>   META-INF/versions/${version} as prefix to the stuff to be included in
>   a jar. I.e.
>   <jar ...>
>      <new-kind-of-zipfileset dir="java9-classes" version="9"/>
>   </jar>
>   would package the content of java9-classes/** under
>   META-INF/versions/9
> * provide a new kind of <zipfileset> that mimics the selection logic
>   when reading from a jar. I.e.
>   <new-kind-of-zipfileset src="some.jar" version="9"/>
>   will include the contents and meta-data like timestamp of
>   META-INF/versions/9/org/example/Foo.class using the name
>   org/example/Foo.class
> * Multi-Release JARs need a special manifest attribute, we should add an
>   attribute to the jar task that sets this.

I dont think so. We could set this flag by ourself if the
<new-kind-of-zipfileset> is set.

We discussed also the possibility of merging different jars.
Say you have a Java8 jar, a Java9 jar and a Java10 jar, you could merge
these into a multirelease jar.

Because of the different classfile versions, the common files of these jars
arent identical, so we cant find them easily. So the easy, but not smart,
solution ends in having the common files in every version branch of the jar.

Another idea I had (for few minutes) is combining the jar'ing with the
  <mrjar ...>
     <default targetdir=""><src-resource-collection></default>
     <version version="9" targetdir=""><src-resource-collection> point to
Java9 only </version>
     <version version="10" targetdir=""><src-resource-collection> point to
Java10 only </version>
<mrjar> would do three compile runs now
* default: Java8
* version=9: Java9, with classes from previous runs on classpath (havent
thought about the identical names yet ... ;)
* version=10: Java10, ...
Finally create the MRJar.

(just for bringing these ideas to the mailinglist)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message