java.nio.file.NoSuchFileException:
bazel-out/k8-fastbuild/bin/foobar/tests/testdata/spring_boot_example/MANIFEST.MF
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:149)
at java.base/sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
at java.base/java.nio.file.Files.readAttributes(Files.java:1763)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1225)
at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:727)
at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:844)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:247)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:148)
at jdk.jartool/sun.tools.jar.Main.extract(Main.java:1389)
at jdk.jartool/sun.tools.jar.Main.run(Main.java:403)
at jdk.jartool/sun.tools.jar.Main.main(Main.java:1681)
Since https://github.com/salesforce/rules_spring/commit/67c64580de5a52977e668455e4c689ae911ff9c0, spring boot rules with names matching
*spring-boot-*
or*spring_boot_*
can with an error such as the following if their correspondingjava_library
does not contain aMETA-INF/MANIFEST.MF
file:The root cause is that the
.jar
corresponding to thejava_library
target matches the check in https://github.com/salesforce/rules_spring/blob/67c64580de5a52977e668455e4c689ae911ff9c0/springboot/write_manifest.sh#L15, which causes the next command to attempt to unpackMETA-INF/MANIFEST.MF
from the.jar
. Since this.jar
is build withjava_library
, it usually does not containMETA-INF/MANIFEST.MF
, which causes the script to error out.A fix could be to catch the failure in the
jar
command and continue with the next match in the loop.