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

Jaikiran Pai <[email protected]> Tue, 5 Jul 2022 07:15:39 +0530
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <[email protected]>
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]
>