Skip to content

Native image should ignore non zip/jar classpath entries #3071

@galderz

Description

@galderz

Describe the issue
20.3 maven jars depend on tar.gz files. A tool, like JBang, is free to add these tar.gz files to the java classpath because it states:

Classpath entries that are neither directories nor archives (.zip or .jar files) nor * are ignored.

native-image does not behave that way. Instead it breaks when it encounters something that is not a ZIP, e.g.

Error: Invalid or corrupt jarfile /Users/g/.m2/repository/org/graalvm/nativeimage/svm-hosted-native-linux-amd64/20.3.0/svm-hosted-native-linux-amd64-20.3.0.tar.gz
Caused by: java.util.zip.ZipException: zip END header not found
[jbang] [ERROR] Error during native-image
dev.jbang.ExitException: Error during native-image
	at dev.jbang.cli.BaseBuildCommand.buildNative(BaseBuildCommand.java:320)
	at dev.jbang.cli.BaseBuildCommand.build(BaseBuildCommand.java:135)
	at dev.jbang.cli.Run.prepareArtifacts(Run.java:73)
	at dev.jbang.cli.Run.doCall(Run.java:62)
	at dev.jbang.cli.BaseCommand.call(BaseCommand.java:80)
	at dev.jbang.cli.BaseCommand.call(BaseCommand.java:12)

native-image should behave just like java, javac and others.

The issue is reproducible in master.

I have a fix ready that I'll send PR for shortly.

Steps to reproduce the issue

  1. Create a java file with //DEPS org.graalvm.nativeimage:svm:20.3.0
  2. Invoke jbang --native hello.java

Describe GraalVM and your environment:

  • GraalVM version 20.3 and master
  • JDK major version: 11
  • OS: macOS Catalina]
  • Architecture: AMD64]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions