You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2018/11/26 08:52:58 UTC

[Bug 62952] New: AntClassLoader is not multi-release JAR aware

https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

            Bug ID: 62952
           Summary: AntClassLoader is not multi-release JAR aware
           Product: Ant
           Version: 1.10.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core
          Assignee: notifications@ant.apache.org
          Reporter: javier.armendariz@openbravo.com
  Target Milestone: ---

In the following repository I created an scenario to easily reproduce this:

https://github.com/katanagari7c1/ant-mrjar-support-test

When running the ant script in Java 11, a multi-release JAR file is created and
used by an ant Task which prints a message depending on the class file used. In
this case the Java 8 class is used ignoring the Java 9+ implementation.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

--- Comment #8 from Stefan Huehner <st...@huehner.org> ---
(In reply to Jaikiran Pai from comment #7)
> > Any chance to get a 1.10.6 out in short?
> 
> I'll start a discussion on the dev list. I don't think we are waiting for
> any specific work to make it into this release. We just need to see if one
> of us is available for carrying out the release.

Thanks for getting that on the way.

On other Note we finally got around to double check the nightly build and my
colleague Javier (reporter) confirmed that latest nightly 1.10.6alpha works
fine for us.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

Jaikiran Pai <ja...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |1.10.6
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Jaikiran Pai <ja...@apache.org> ---
This is now fixed in upstream master branch and should be available in next
release - AntClassLoader now recognizes the runtime environment version and
does the necessary work to support multi-release jar files that it uses to load
resources at runtime.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

--- Comment #6 from Stefan Huehner <st...@huehner.org> ---
(In reply to Jaikiran Pai from comment #4)
> >> As we are talking to Ubuntu distro for a potential backport to their stable releases...
> 
> >> Do you have any rough ETA for 1.10.6 ant to be released?
> 
> We currently don't have a specific date in mind. There's one PR (related to
> jmod and jlink task) that's open that I think is a good candidate to go in,
> for this release. Other than that, I don't think there's anything pending.
> However, we need to see if anyone else in the dev team has anything that
> they want to be part of this release and also see if one of us can drive the
> release.
> 
> What is the timelines for the Ubuntu distro upgrade that's being planned?

Hello,
sorry for getting back so late after end of year break.

I was asking Debian/Ubuntu people on irc as they said best would be 'end of
January'. Checking projects dates:
Upcoming Ubuntu freeze: February 21st (Debian import freeze)
Upcoming Debian freeze Februrary 12th:
    2019-01-12 - Transition freeze
    2019-02-12 - Soft-freeze
    2019-03-12 - Full-freeze

Note: Their maintainers would need a bit of time also.

Checking that other MR you mentioned last time about jmod/jlink seems to have
been finished in the meantime.

Any chance to get a 1.10.6 out in short?

Note: If not possible, looks they could backport it later on top of .5

13:45 < ebourg> huehner: Ant is easy to backport, if the version 1.10.6 isn't 
                in Buster we can bring it to buster-backports after the release

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

Jaikiran Pai <ja...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|https://games.lol/android/  |

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

--- Comment #3 from Stefan Huehner <st...@huehner.org> ---
(In reply to Jaikiran Pai from comment #2)
> This is now fixed in upstream master branch and should be available in next
> release - AntClassLoader now recognizes the runtime environment version and
> does the necessary work to support multi-release jar files that it uses to
> load resources at runtime.

Hello,
coworker of the reporter here.

Thanks for getting that fixed so fast :)

As we are talking to Ubuntu distro for a potential backport to their stable
releases...

Do you have any rough ETA for 1.10.6 ant to be released?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

--- Comment #4 from Jaikiran Pai <ja...@apache.org> ---
>> As we are talking to Ubuntu distro for a potential backport to their stable releases...

>> Do you have any rough ETA for 1.10.6 ant to be released?

We currently don't have a specific date in mind. There's one PR (related to
jmod and jlink task) that's open that I think is a good candidate to go in, for
this release. Other than that, I don't think there's anything pending. However,
we need to see if anyone else in the dev team has anything that they want to be
part of this release and also see if one of us can drive the release.

What is the timelines for the Ubuntu distro upgrade that's being planned?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

--- Comment #7 from Jaikiran Pai <ja...@apache.org> ---
> Any chance to get a 1.10.6 out in short?

I'll start a discussion on the dev list. I don't think we are waiting for any
specific work to make it into this release. We just need to see if one of us is
available for carrying out the release.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

--- Comment #1 from Jaikiran Pai <ja...@apache.org> ---
Hello Javier,

It's true that AntClassLoader currently out of the box doesn't support
multi-release jar files. The java.util.jar.JarFile documentation[1] has an
interesting and useful information which states:

<quote>
Implementation Note:
    If the API can not be used to configure a JarFile (e.g. to override the
configuration of a compiled application or library), two System properties are
available.

        jdk.util.jar.version can be assigned a value that is the String
representation of a non-negative integer <= Runtime.version().major(). The
value is used to set the effective runtime version to something other than the
default value obtained by evaluating Runtime.version().major(). The effective
runtime version is the version that the JarFile(File, boolean, int,
Runtime.Version) constructor uses when the value of the last argument is
JarFile.runtimeVersion().
        jdk.util.jar.enableMultiRelease can be assigned one of the three String
values true, false, or force. The value true, the default value, enables
multi-release jar file processing. The value false disables multi-release jar
processing, ignoring the "Multi-Release" manifest attribute, and the versioned
directories in a multi-release jar file if they exist. Furthermore, the method
isMultiRelease() returns false. The value force causes the JarFile to be
initialized to runtime versioning after construction. It effectively does the
same as this code: (new JarFile(File, boolean, int, JarFile.runtimeVersion()).



</quote>


So I set up the 'jdk.util.jar.enableMultiRelease' system property to 'force'
through ANT_OPTS as follows:

export ANT_OPTS="-Djdk.util.jar.enableMultiRelease=force"

and ran your example:

ant -f ant-test.xml

on a Java 9 setup and it worked fine and used the Java 9 version of the task.
Here's the snippet from the output:

run.task:
 [testTask] Executing Java9+ Task. MRJAR is supported!
     [echo] ========================================
     [echo] Now using the same jar in a jvm process
     [echo] ========================================
     [java] Executing Java9+ Task. MRJAR is supported!



Having said that, we can certainly make AntClassLoader support multi-release
jar file out of the box and I'll go ahead and commit a change for that so it's
available in the next release.

[1] https://docs.oracle.com/javase/9/docs/api/java/util/jar/JarFile.html

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

--- Comment #5 from Jaikiran Pai <ja...@apache.org> ---
By the way, in case your team is interested in trying out this (or other
upcoming changes), then you can give our nightly build a quick try
https://builds.apache.org/view/A/view/Ant/job/Ant_Nightly/lastSuccessfulBuild/artifact/distribution/
and make sure things work fine.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

steve anders <ga...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://games.lol/android/

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62952] AntClassLoader is not multi-release JAR aware

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

Stefan Huehner <st...@huehner.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stefan@huehner.org

-- 
You are receiving this mail because:
You are the assignee for the bug.