fix_jar() tries to remove an existing Class-Path entry from the jar
manifest by postprocessing the manifest and passing it to `jar -um`.
However, `jar -um` can only add/replace manifest entries, not remove
them, and it also complains loudly when replacing an entry:
Dec 13, 2022 7:11:19 PM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Manifest-Version.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
Thus fix_jar() produces one such warning for each entry in the manifest
and accomplishes nothing else.
Use jar -uM instead. This completely removes the manifest from the jar
and allows adding it back as a normal zip member, fixing fix_jar() and
avoiding the warnings.
Fixes: https://github.com/mesonbuild/meson/issues/10491
Fixes: c70a051e93
("java: remove manifest classpath from installed jar")
pull/11174/head
parent
51c889ddbc
commit
35e230e48c
5 changed files with 62 additions and 1 deletions
@ -0,0 +1,7 @@ |
||||
package com.mesonbuild; |
||||
|
||||
class Simple { |
||||
public static void main(String [] args) { |
||||
System.out.println("Java is working.\n"); |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
project('simplejava', 'java') |
||||
|
||||
one = jar('one', 'com/mesonbuild/Simple.java', |
||||
main_class : 'com.mesonbuild.Simple', |
||||
install : true, |
||||
install_dir : get_option('bindir'), |
||||
) |
||||
|
||||
two = jar('two', 'com/mesonbuild/Simple.java', |
||||
main_class : 'com.mesonbuild.Simple', |
||||
install : true, |
||||
install_dir : get_option('bindir'), |
||||
link_with : one, |
||||
) |
Loading…
Reference in new issue