-
Notifications
You must be signed in to change notification settings - Fork 1.7k
native-image-maven-plugin UnsupportedOperationException for project with com.oracle.substratevm:svm:1.0.0-rc12 as dependency #1003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The right approach to use
The key here is that you use |
Right, that does make sense :) Still, I feel it's a bug that the Maven plugin will try to parse any artifact as a JAR. (It's only illustrated by the com.oracle.substratevm:svm artifact, it's not limited to it.) |
Makes sense. I will add a check that issues a warning for non-jar files. Or if you like I can hold off until you have completed the OCA signing procedure and we merge your change instead. |
I hope you can wait for the OCA procedure to finish then :) |
Fixed on master 8020b64 |
I am using the native-image-maven-plugin to make a native image for a Maven project. This project needs the com.oracle.substratevm:svm:1.0.0-rc12 dependency, because I need to use the com.oracle.svm.core.annotate.* annotations. But that dependency, by default, transitively includes dependencies that are not JAR files. For example, it depends on com.oracle.substratevm:svm-hosted-native-linux-amd64:1.0.0-rc12 which is a *.tar.gz file.
The native-image-maven-plugin fetches all dependencies, and tries to parse them as JAR files. This fails for com.oracle.substratevm:svm-hosted-native-linux-amd64:1.0.0-rc12, and results in a UnsupportedOperationException.
Work-around
Quick work-around is to exclude all non-JAR dependencies:
Alternatively, if you do not require any transitive dependency, you can use:
(I feel the com.oracle.svm.core.annotate.* classes should be in a separate artifact, but that's a different story.)
How to reproduce
Change the pom.xml of com.oracle.substratevm:native-image-maven-plugin-test to include the following dependency:
And then run
mvn verify
for that project. Output will be:The text was updated successfully, but these errors were encountered: