Re: [External] : Odd jdk8->jdk17 <jar> behaviour with ant

Dave Brosius <[email protected]> Mon, 4 Jul 2022 22:33:30 -0400
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <[email protected]>
this is linux mint (5.4.0-120-generic)

I agree there is something going on with ant. like the jar isn't closing 
until the ant process closes. As for a sample, I grossly simplified the 
explanation. but the two steps that fail back to back are jar creation 
and an ant task that reads a locale from that jar.


On 7/4/22 21:45, Jaikiran Pai wrote:
> Hello Dave,
>
> I see that you seem to have got past this. However, looking at what 
> you describe in your first post, this looks like a genuine issue that 
> needs some investigation to narrow down why this fails on Java 17. 
> Would you be able to share a reproducer for this? What operating 
> system is this issue showing up?
>
> > There is no ant task forking going on here. (Can you even fork a 
> <jar> task?)
>
> Ant doesn't launch the "jar" command for the jar task. Instead it 
> internally uses (an in-process) set of APIs for writing out the output 
> stream.
>
> -Jaikiran
>
>
> On 04/07/22 8:31 pm, Dave Brosius wrote:
>> Rubber Duck Debugging at it's finest.
>>
>> I changed the code to do
>>
>> <jar destfile="${some_temp_location}"..../>
>> <move file="${some_temp_location}" tofile="${the_real_location}"/>
>>
>> and now it works fine.
>>
>>
>>
>> On 7/4/22 10:45, Dave Brosius wrote:
>>> Hi Folks,
>>>
>>>     I realize this is probably difficult to understand, or give 
>>> ideas on, but i'll give it a go.
>>>
>>> I have an existing build.xml file that's been used for years to 
>>> build on java8 (ant 1.10.2). Now trying to migrate stuff to 17.
>>>
>>> Ran in to this problem, and going to simplify as best as possible.
>>>
>>> Have 3 ant targets, related as such
>>>
>>> <target name="coordinator" depends="producer, consumer"/>
>>>
>>> the producer target uses the <jar> task to produce a jar file, that 
>>> includes resource bundle property files.
>>>
>>> the consumer target has a custom ant task that loads Locales using 
>>> the above jar's resource bundles. (thus the above jar is on this 
>>> task's classpath)
>>>
>>> In java 8 running
>>>
>>> ant coordinator
>>>
>>> works fine. In java 17, if I do
>>>
>>> ant producer
>>> ant consumer
>>>
>>> it also works fine, if however i do
>>>
>>> ant coordinator
>>>
>>> i get
>>>
>>> java.util.zip.ZipException: ZipFile invalid LOC header (bad signature)
>>>
>>>
>>> when the custom ant task tries to load the resource bundle from the jar
>>>
>>> I have to assume this is  because ant isn't done writing the jar 
>>> yet? Or maybe it hasn't been flushed yet? There is no ant task 
>>> forking going on here. (Can you even fork a <jar> task?)
>>>
>>> Any ideas what could be wrong, or how to fix?
>>>
>>>
>>> thanks,
>>>
>>> dave
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>